diff --git a/lib/views/HomePage.dart b/lib/views/HomePage.dart index 630f4e3..63ab798 100644 --- a/lib/views/HomePage.dart +++ b/lib/views/HomePage.dart @@ -17,16 +17,6 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { 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)), @@ -52,122 +42,125 @@ class _HomePageState extends State { _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, ), - ], - ), - )); + ), + ], + ), + ), + ); } }