feat: main page
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../components/spacer/spacer.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'widgets/email_field.dart';
|
||||
import 'widgets/password_field.dart';
|
||||
|
||||
@@ -76,6 +77,8 @@ class _LoginPageState extends State<LoginPage> with TickerProviderStateMixin {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
|
||||
context.router.replace(const MainRoute());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('HomePage'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../router/app_router.gr.dart';
|
||||
import 'widgets/bottom_navbar.dart';
|
||||
|
||||
@RoutePage()
|
||||
class MainPage extends StatelessWidget {
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AutoTabsRouter.pageView(
|
||||
routes: [HomeRoute(), TransactionRoute(), ReportRoute(), ProfileRoute()],
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
builder: (context, child, pageController) {
|
||||
final tabsRouter = AutoTabsRouter.of(context);
|
||||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: child,
|
||||
bottomNavigationBar: MainBottomNavbar(tabsRouter: tabsRouter),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:line_icons/line_icon.dart';
|
||||
import 'package:line_icons/line_icons.dart';
|
||||
|
||||
class MainBottomNavbar extends StatefulWidget {
|
||||
final TabsRouter tabsRouter;
|
||||
|
||||
const MainBottomNavbar({super.key, required this.tabsRouter});
|
||||
|
||||
@override
|
||||
State<MainBottomNavbar> createState() => _MainBottomNavbarState();
|
||||
}
|
||||
|
||||
class _MainBottomNavbarState extends State<MainBottomNavbar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: widget.tabsRouter.activeIndex,
|
||||
onTap: (index) {
|
||||
setState(() {
|
||||
widget.tabsRouter.setActiveIndex(index);
|
||||
});
|
||||
},
|
||||
type: BottomNavigationBarType.fixed,
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
icon: LineIcon(LineIcons.home),
|
||||
label: 'Home',
|
||||
tooltip: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: LineIcon(LineIcons.moneyBill),
|
||||
label: 'Transaction',
|
||||
tooltip: 'Transaction',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: LineIcon(LineIcons.barChart),
|
||||
label: 'Report',
|
||||
tooltip: 'Report',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: LineIcon(LineIcons.user),
|
||||
label: 'Profile',
|
||||
tooltip: 'Profile',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ProfilePage extends StatelessWidget {
|
||||
const ProfilePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('ProfilePage'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class ReportPage extends StatelessWidget {
|
||||
const ReportPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('ReportPage'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class TransactionPage extends StatelessWidget {
|
||||
const TransactionPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('TransactionPage'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user