diff --git a/app/lib/features/material/menu/presentation/pages/material_menu.dart b/app/lib/features/material/menu/presentation/pages/material_menu.dart index 5499511..510028c 100644 --- a/app/lib/features/material/menu/presentation/pages/material_menu.dart +++ b/app/lib/features/material/menu/presentation/pages/material_menu.dart @@ -42,17 +42,20 @@ class _MaterialMenuState extends State { child: OutlinedButton( style: OutlinedButton.styleFrom( backgroundColor: filterIndex == index ? Colors.blue : Colors.white, - side: BorderSide(width: 1, color: Color(0xFF1BB8E1),), + side: BorderSide( + width: 1, + color: Color(0xFF1BB8E1), + ), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(18.0), ), ), // buttonType: filterIndex == index ? ButtonType.secondary : null, - child: Text(text, style: TextStyle( - fontSize: 14.0, - color: filterIndex == index ? Colors.white : Colors.grey, - ) - ), + child: Text(text, + style: TextStyle( + fontSize: 14.0, + color: filterIndex == index ? Colors.white : Colors.grey, + )), onPressed: () { setState(() { filterIndex = index; @@ -84,12 +87,20 @@ class _MaterialMenuState extends State { }, child: Container( padding: const EdgeInsets.all(10), - margin: const EdgeInsets.only(bottom: 12, left: 5, right: 5,), + margin: const EdgeInsets.only( + bottom: 12, + left: 5, + right: 5, + ), height: 80, width: double.infinity, decoration: BoxDecoration( color: Colors.white, - borderRadius: const BorderRadius.all(Radius.circular(24,),), + borderRadius: const BorderRadius.all( + Radius.circular( + 24, + ), + ), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.5), @@ -133,120 +144,136 @@ class _MaterialMenuState extends State { @override Widget build(BuildContext context) { return - // BebrasScaffold( - // avoidBottomInset: false, - // body: Padding( - // padding: const EdgeInsets.only(top: 10), - // child: + // BebrasScaffold( + // avoidBottomInset: false, + // body: Padding( + // padding: const EdgeInsets.only(top: 10), + // child: Stack( - children: [ - Container( - // padding: const EdgeInsets.all(32), - child: Column( - children: [ - // Image.asset( - // Assets.bebrasPandaiText, - // ), - // const SizedBox( - // height: 30, - // ), - SizedBox( - height: 40, - width: MediaQuery.of(context).size.width - 10, - child: ListView( - scrollDirection: Axis.horizontal, - children: [ - ...bebrasGroupList.map( - (e) => materialTab(e.label, e.index), + children: [ + Container( + padding: const EdgeInsets.only( + left: 25.0, + ), + child: Column( + children: [ + // Image.asset( + // Assets.bebrasPandaiText, + // ), + // const SizedBox( + // height: 30, + // ), + SizedBox( + height: 40, + width: MediaQuery.of(context).size.width - 10, + child: ListView( + scrollDirection: Axis.horizontal, + children: [ + ...bebrasGroupList.map( + (e) => materialTab(e.label, e.index), + ), + ], + ), + ), + Container( + padding: const EdgeInsets.only( + right: 25.0, + ), + child: Column( + children: [ + const SizedBox( + height: 10, + ), + const SizedBox( + width: double.infinity, + child: Text( + 'Daftar Materi', + style: TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, ), - ], + ), + ), + const SizedBox( + height: 10, ), - ), - const SizedBox( - height: 10, - ), - const SizedBox( - width: double.infinity, - child: Text('Daftar Materi'), - ), - const SizedBox( - height: 10, - ), - StreamBuilder( - stream: materialsStream, - builder: ( - BuildContext context, - AsyncSnapshot snapshot, - ) { - if (snapshot.hasError) { - return const Text('Something went wrong'); - } + StreamBuilder( + stream: materialsStream, + builder: ( + BuildContext context, + AsyncSnapshot snapshot, + ) { + if (snapshot.hasError) { + return const Text('Something went wrong'); + } - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center( - child: CircularProgressIndicator(), - ); - } + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center( + child: CircularProgressIndicator(), + ); + } - var displayEmpty = true; - final boxHeight = - MediaQuery.of(context).size.height - 474; - return SingleChildScrollView( - child: SizedBox( - height: boxHeight, - width: double.infinity, - child: ListView( - children: [ - ...snapshot.data!.docs.map((d) { - final materialDoc = - d.data()! as Map; - if (materialDoc['challenge_group'] == - bebrasGroupList[filterIndex].key) { - displayEmpty = false; - return materialItem( - d.id, - materialDoc['title'] as String, - materialDoc['url'] as String, - File('$basePath${d.id}.pdf').existsSync(), - ); - } - return Container(); - }), - if (displayEmpty) - Transform.translate( - offset: const Offset( - 0, - -10, - ), // Set the desired offset - child: Container( - height: boxHeight, - padding: const EdgeInsets.all(10), - margin: const EdgeInsets.only( - bottom: 12, - top: 12, - ), - decoration: BoxDecoration( - color: Colors.blue[50], - borderRadius: BorderRadius.circular(8), - ), - child: const Center( - child: Text( - 'Materi belum ada', + var displayEmpty = true; + final boxHeight = MediaQuery.of(context).size.height - 474; + return SingleChildScrollView( + child: SizedBox( + height: boxHeight, + width: double.infinity, + child: ListView( + children: [ + ...snapshot.data!.docs.map((d) { + final materialDoc = + d.data()! as Map; + if (materialDoc['challenge_group'] == + bebrasGroupList[filterIndex].key) { + displayEmpty = false; + return materialItem( + d.id, + materialDoc['title'] as String, + materialDoc['url'] as String, + File('$basePath${d.id}.pdf').existsSync(), + ); + } + return Container(); + }), + if (displayEmpty) + Transform.translate( + offset: const Offset( + 0, + -10, + ), // Set the desired offset + child: Container( + height: boxHeight, + padding: const EdgeInsets.all(10), + margin: const EdgeInsets.only( + bottom: 12, + top: 12, + ), + decoration: BoxDecoration( + color: Colors.blue[50], + borderRadius: BorderRadius.circular(8), + ), + child: const Center( + child: Text( + 'Materi belum ada', + ), ), ), ), - ), - ], + ], + ), ), - ), - ); - }, - ), - ], + ); + }, + ), + ], + ), ), - ), - ], - ); + ], + ), + ), + ], + ); // ), // ); }