Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 107 additions & 114 deletions lib/views/HomePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,6 @@ class HomePage extends StatefulWidget {
class _HomePageState extends State<HomePage> {
Future openCamera() async {
availableCameras().then((cameras) async {
/* final imagePath = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CameraScreen(cameras), //CameraPage(cameras),
),
);
setState(() {
// _imagePath = imagePath;
}); */

Navigator.push(
context,
MaterialPageRoute(builder: (context) => CameraScreen(cameras)),
Expand All @@ -52,122 +42,125 @@ class _HomePageState extends State<HomePage> {
_vids = videoProvider.getVidList();

return Scaffold(
appBar: AppBar(
title: Text('IB App'),
),
floatingActionButton: FloatingActionButton(
onPressed: openCamera,
child: Icon(
Icons.photo_camera,
color: Colors.white,
),
backgroundColor: Colors.blue,
),
body: _vids.isNotEmpty
? Container(
width: width,
height: height,
child: ListView.builder(
itemCount: _vids.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PlayLocalVideoScreen(
localVid: _vids[index],
)),
);
},
child: Container(
margin: EdgeInsets.symmetric(
vertical: 20, horizontal: width * 0.02),
height: height * 0.35,
width: width,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4,
offset: Offset(0, 0),
spreadRadius: 2)
]),
child: Stack(
children: [
Container(
height: height * 0.28,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
image: FileImage(
(File(_vids[index].thumbnail)),
),
fit: BoxFit.cover)),
child: Center(
child: Icon(
appBar: AppBar(title: Text('IB App')),
floatingActionButton: FloatingActionButton(
onPressed: openCamera,
child: Icon(Icons.photo_camera, color: Colors.white),
backgroundColor: Colors.blue,
),
body: _vids.isNotEmpty
? Container(
width: width,
height: height,
child: ListView.builder(
itemCount: _vids.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PlayLocalVideoScreen(localVid: _vids[index]),
),
);
},
child: Container(
margin: EdgeInsets.symmetric(
vertical: 20,
horizontal: width * 0.02,
),
height: height * 0.35,
width: width,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.grey,
blurRadius: 4,
offset: Offset(0, 0),
spreadRadius: 2,
),
],
),
child: Stack(
children: [
Container(
height: height * 0.28,
width: width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
image: DecorationImage(
image: FileImage(
(File(_vids[index].thumbnail)),
),
fit: BoxFit.cover,
),
),
child: Center(
child: Icon(
Icons.play_arrow,
size: 50,
color: Colors.white,
)),
),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
margin: EdgeInsets.only(left: 20, bottom: 12),
child: Text(
_vids[index].vidName,
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 17),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
margin: EdgeInsets.only(left: 20, bottom: 12),
child: Text(
_vids[index].vidName,
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 17,
),
),
),
Align(
alignment: Alignment.bottomRight,
child: Container(
margin: EdgeInsets.only(right: 20, bottom: 12),
child: Text(
videoProvider.timeStampToTime(
timeStamp: _vids[index].time),
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 12),
),
Align(
alignment: Alignment.bottomRight,
child: Container(
margin: EdgeInsets.only(right: 20, bottom: 12),
child: Text(
videoProvider.timeStampToTime(
timeStamp: _vids[index].time,
),
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
),
],
),
),
],
),
);
},
),
)
: Container(
width: width,
height: height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.video_call,
size: 50,
),
SizedBox(
height: 30,
),
Text(
'No Videos Found..',
style: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold),
);
},
),
)
: Container(
width: width,
height: height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.video_call, size: 50),
SizedBox(height: 30),
Text(
'No Videos Found..',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
),
],
),
));
),
],
),
),
);
}
}
Loading