diff --git a/app/lib/core/bases/widgets/layout/bottom_navbar.dart b/app/lib/core/bases/widgets/layout/bottom_navbar.dart index 30934fb..ee7f4f4 100644 --- a/app/lib/core/bases/widgets/layout/bottom_navbar.dart +++ b/app/lib/core/bases/widgets/layout/bottom_navbar.dart @@ -1,15 +1,12 @@ import 'dart:ui'; - -// import 'package:artefak/services/auth.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -// import 'package:artefak/widgets/auth_sliding_panel.dart'; class BottomNavBar extends StatefulWidget { const BottomNavBar({ - Key? key, + super.key, required this.currentIndex, - }) : super(key: key); + }); final int currentIndex; @@ -18,22 +15,21 @@ class BottomNavBar extends StatefulWidget { } class _BottomNavBarState extends State { - int _currentIndex = 0; // To track the selected menu item + // To track the selected menu item + int _currentIndex = 0; void _onTap(int index, BuildContext context) { switch (index) { case 0: - Navigator.popUntil(context, ModalRoute.withName('/')); + Navigator.popUntil(context, ModalRoute.withName('/main')); break; case 1: - Navigator.pushNamed(context, '/collection'); + Navigator.pushNamed(context, '/setting'); break; } } @override Widget build(BuildContext context) { - ThemeData _themeData = Theme.of(context); - // Update the selected menu item index and rebuild the widget void _updateIndex(int newIndex) { setState(() { @@ -44,26 +40,29 @@ class _BottomNavBarState extends State { // Custom method to build IconButton with color change based on selection Widget _buildIconButton(IconData icon, String label, int index) { return SizedBox.fromSize( - size: Size(80, 56), + size: const Size(80, 56), child: Material( color: Colors.transparent, child: InkWell( - onTap: () {}, + onTap: () { + _updateIndex(index); + _onTap(index, context); + }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ FaIcon( icon, - color: _currentIndex == index ? Colors.blue : Colors.grey, + color: _currentIndex == index ? const Color(0xFF1BB8E1) : Colors.grey, ), - SizedBox( + const SizedBox( height: 5, ), Text( label, style: TextStyle( - fontSize: 11.0, - color: _currentIndex == index ? Colors.blue : Colors.grey, + fontSize: 11, + color: _currentIndex == index ? const Color(0xFF1BB8E1) : Colors.grey, ), ), ], @@ -71,61 +70,37 @@ class _BottomNavBarState extends State { ), ), ); - // return IconButton( - // icon: FaIcon( - // icon, - // color: _currentIndex == index ? Colors.blue : Colors.grey, - // ), - // onPressed: () { - // _updateIndex(index); - // }, - // ); } return ClipRect( child: BackdropFilter( filter: ImageFilter.blur( - sigmaX: 30.0, - sigmaY: 30.0, + sigmaX: 30, + sigmaY: 30, ), child: SizedBox( height: 60, child: BottomAppBar( elevation: 2, - // items: [ shape: const CircularNotchedRectangle(), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - _buildIconButton(FontAwesomeIcons.fileLines, "Materi", 0), + _buildIconButton(FontAwesomeIcons.fileLines, 'Materi', 0), Container( margin: const EdgeInsets.only( - bottom: 9.0, + bottom: 9, ), alignment: Alignment.bottomCenter, - child: Text( + child: const Text( "Latihan", - style: TextStyle(fontSize: 11.0), + style: TextStyle(fontSize: 11), ), ), - _buildIconButton(FontAwesomeIcons.gear, "Pengaturan", 1), - // IconButton( - // onPressed: () { - // _updateIndex(0); - // }, - // icon: const FaIcon(FontAwesomeIcons.fileLines), - // ), - // IconButton( - // onPressed: () { - // _updateIndex(1); - // }, - // icon: const FaIcon(FontAwesomeIcons.gear), - // ), + _buildIconButton(FontAwesomeIcons.gear, 'Pengaturan', 1), ], ), - // currentIndex: currentIndex, - // onTap: (index) => _onTap(index, context), ), ), ), diff --git a/app/lib/features/main/presentation/pages/home_page.dart b/app/lib/features/main/presentation/pages/home_page.dart index 673425c..8f77f5f 100644 --- a/app/lib/features/main/presentation/pages/home_page.dart +++ b/app/lib/features/main/presentation/pages/home_page.dart @@ -38,8 +38,8 @@ class _HomePageState extends State { ClipPath( clipper: ClipPathClass(), child: Container( - height: 250.0, - color: Color(0xFF1BB8E1), + height: 250, + color: const Color(0xFF1BB8E1), ), ), Column( @@ -84,112 +84,30 @@ class _HomePageState extends State { items: imgList .map((item) => Container( margin: const EdgeInsets.only( - left: 10.0, - right: 10.0, + left: 10, + right: 10, ), decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.green, ), child: ClipRRect( - borderRadius: BorderRadius.circular(10.0), - child: Image.network(item, fit: BoxFit.cover, width: 300.0,), + borderRadius: BorderRadius.circular(10), + child: Image.network(item, fit: BoxFit.cover, width: 300,), ), )) .toList(), options: CarouselOptions( height: 150, - aspectRatio: 16 / 9, viewportFraction: 1, - initialPage: 0, - enableInfiniteScroll: true, - reverse: false, autoPlay: true, - autoPlayInterval: Duration(seconds: 3), - autoPlayAnimationDuration: Duration(milliseconds: 800), - autoPlayCurve: Curves.fastOutSlowIn, - // enlargeCenterPage: true, - // enlargeFactor: 0.3, - // onPageChanged: callbackFunction, - scrollDirection: Axis.horizontal, + autoPlayInterval: const Duration(seconds: 3), ), ), ], ), ), - // Expanded( - // child: SingleChildScrollView( - // child: Column( - // children: [ const MaterialMenu(), - // Button( - // onTap: () async { - // final url = Uri.parse( - // 'https://bebras.or.id/v3/bebras-indonesia-challenge-2023/', - // ); - // if (!await launchUrl(url)) { - // throw Exception('Could not launch $url'); - // } - // }, - // customButtonColor: Colors.blue, - // customTextColor: Colors.white, - // text: 'ℹ️ Tentang Tantangan Bebras ℹ️', - // ), - // const SizedBox( - // height: 25, - // ), - // Button( - // buttonType: ButtonType.primary, - // onTap: () async { - // await context.push('/material'); - // }, - // text: 'Lihat / Cetak Materi', - // ), - // const SizedBox( - // height: 25, - // ), - // Button( - // buttonType: ButtonType.primary, - // onTap: () async { - // await context.push('/quiz_registration'); - // }, - // text: 'Ikut Latihan Mingguan', - // ), - // const SizedBox( - // height: 25, - // ), - // Button( - // onTap: () async { - // await context.push('/setting'); - // }, - // customButtonColor: Colors.grey, - // customTextColor: Colors.white, - // text: 'Pengaturan', - // ), - // SizedBox( - // height: 120, - // ), - // InkWell( - // onTap: () async { - // final url = Uri.parse( - // 'https://tlx.toki.id/', - // ); - // if (!await launchUrl(url)) { - // throw Exception('Could not launch $url'); - // } - // }, - // child: Center( - // child: Text( - // 'From Ikatan Alumni TOKI with ❤️', - // textAlign: TextAlign.center, - // style: FontTheme.greyNormal14(), - // ), - // ), - // ), - // ], - // ), - // ), - // ), ], ), ], @@ -199,7 +117,7 @@ class _HomePageState extends State { onPressed: () {}, child: const FaIcon(FontAwesomeIcons.graduationCap), ), - bottomNavigationBar: BottomNavBar( + bottomNavigationBar: const BottomNavBar( currentIndex: 0, ), ); 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 8aafec3..157e2b5 100644 --- a/app/lib/features/material/menu/presentation/pages/material_menu.dart +++ b/app/lib/features/material/menu/presentation/pages/material_menu.dart @@ -41,8 +41,8 @@ class _MaterialMenuState extends State { ), child: OutlinedButton( style: OutlinedButton.styleFrom( - backgroundColor: filterIndex == index ? Colors.blue : Colors.white, - side: BorderSide( + backgroundColor: filterIndex == index ? const Color(0xFF1BB8E1) : Colors.white, + side: const BorderSide( width: 1, color: Color(0xFF1BB8E1), ), @@ -106,7 +106,7 @@ class _MaterialMenuState extends State { color: Colors.grey.withOpacity(0.5), spreadRadius: 2, blurRadius: 4, - offset: Offset(0, 3), // changes position of shadow + offset: const Offset(0, 3), // changes position of shadow ), ], ), @@ -131,7 +131,7 @@ class _MaterialMenuState extends State { icon: const Icon( Icons.print_rounded, size: 28, - color: Colors.blue, + color: Color(0xFF1BB8E1), ), iconSize: 28, ), @@ -143,13 +143,7 @@ class _MaterialMenuState extends State { @override Widget build(BuildContext context) { - return - // BebrasScaffold( - // avoidBottomInset: false, - // body: Padding( - // padding: const EdgeInsets.only(top: 10), - // child: - Stack( + return Stack( children: [ Container( padding: const EdgeInsets.only( @@ -157,12 +151,6 @@ class _MaterialMenuState extends State { ), child: Column( children: [ - // Image.asset( - // Assets.bebrasPandaiText, - // ), - // const SizedBox( - // height: 30, - // ), SizedBox( height: 40, width: MediaQuery.of(context).size.width - 10, @@ -207,14 +195,16 @@ class _MaterialMenuState extends State { return const Text('Something went wrong'); } - if (snapshot.connectionState == ConnectionState.waiting) { + if (snapshot.connectionState == + ConnectionState.waiting) { return const Center( child: CircularProgressIndicator(), ); } var displayEmpty = true; - final boxHeight = MediaQuery.of(context).size.height - 456; // TODO: set the safe number to be the box height + final boxHeight = MediaQuery.of(context).size.height - + 456; // TODO: set the safe number to be the box height return SingleChildScrollView( child: SizedBox( height: boxHeight, @@ -241,7 +231,7 @@ class _MaterialMenuState extends State { offset: const Offset( 0, -10, - ), // Set the desired offset + ), child: Container( height: boxHeight, padding: const EdgeInsets.all(10), @@ -274,8 +264,6 @@ class _MaterialMenuState extends State { ), ], ); - // ), - // ); } // PDF print