main page
This commit is contained in:
@@ -10,6 +10,7 @@ import '../../../components/assets/assets.gen.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../components/spaces/space.dart';
|
||||
import '../../../components/toast/flushbar.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
import 'widgets/email_field.dart';
|
||||
import 'widgets/password_field.dart';
|
||||
|
||||
@@ -29,12 +30,8 @@ class LoginPage extends StatelessWidget implements AutoRouteWrapper {
|
||||
(f) => AppFlushbar.showAuthFailureToast(context, f),
|
||||
(data) {
|
||||
if (context.mounted) {
|
||||
AppFlushbar.showSuccess(
|
||||
context,
|
||||
'Login berhasil! Selamat datang, ${data.user.name}.',
|
||||
);
|
||||
// context.read<AuthBloc>().add(AuthEvent.fetchCurrentUser());
|
||||
// context.router.replace(const MainRoute());
|
||||
context.router.replace(const MainRoute());
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../common/theme/theme.dart';
|
||||
import '../../components/assets/assets.gen.dart';
|
||||
import '../../router/app_router.gr.dart';
|
||||
|
||||
@RoutePage()
|
||||
class MainPage extends StatelessWidget {
|
||||
const MainPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AutoTabsRouter(
|
||||
routes: [
|
||||
HomeRoute(),
|
||||
TableRoute(),
|
||||
ReportRoute(),
|
||||
CustomerRoute(),
|
||||
SettingRoute(),
|
||||
],
|
||||
builder: (context, child) {
|
||||
final tabsRouter = AutoTabsRouter.of(context);
|
||||
|
||||
return Scaffold(
|
||||
body: Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
selectedIndex: tabsRouter.activeIndex,
|
||||
onDestinationSelected: tabsRouter.setActiveIndex,
|
||||
labelType: NavigationRailLabelType.none,
|
||||
backgroundColor: AppColor.primary,
|
||||
selectedIconTheme: const IconThemeData(color: Colors.white),
|
||||
indicatorColor: AppColor.disabled.withOpacity(0.25),
|
||||
indicatorShape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
),
|
||||
minExtendedWidth: 56,
|
||||
leading: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Assets.images.logoWhite.image(
|
||||
width: 40,
|
||||
height: 40,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
trailing: Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.logout,
|
||||
color: AppColor.disabled,
|
||||
),
|
||||
onPressed: () {},
|
||||
tooltip: 'Logout',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
destinations: const [
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.home_outlined, color: AppColor.disabled),
|
||||
selectedIcon: Icon(Icons.home, color: AppColor.white),
|
||||
label: Text('POS'),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(
|
||||
Icons.table_bar_outlined,
|
||||
color: AppColor.disabled,
|
||||
),
|
||||
selectedIcon: Icon(Icons.person, color: AppColor.white),
|
||||
label: Text('Meja'),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(
|
||||
Icons.pie_chart_outline_outlined,
|
||||
color: AppColor.disabled,
|
||||
),
|
||||
selectedIcon: Icon(Icons.settings, color: AppColor.white),
|
||||
label: Text('Laporan'),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(
|
||||
Icons.person_2_outlined,
|
||||
color: AppColor.disabled,
|
||||
),
|
||||
selectedIcon: Icon(Icons.person_2, color: AppColor.white),
|
||||
label: Text('Pelanggan'),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Icon(
|
||||
Icons.settings_outlined,
|
||||
color: AppColor.disabled,
|
||||
),
|
||||
selectedIcon: Icon(Icons.settings, color: AppColor.white),
|
||||
label: Text('Pengaturan'),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
const VerticalDivider(thickness: 1, width: 1),
|
||||
// Main content area
|
||||
Expanded(child: child),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class CustomerPage extends StatelessWidget {
|
||||
const CustomerPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Placeholder();
|
||||
}
|
||||
}
|
||||
@@ -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 const Center(child: Text('Home Page'));
|
||||
}
|
||||
}
|
||||
@@ -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 const Center(child: Text('Report Page'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class SettingPage extends StatelessWidget {
|
||||
const SettingPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Center(child: Text('Setting Page'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class TablePage extends StatelessWidget {
|
||||
const TablePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'Table Page',
|
||||
style: Theme.of(context).textTheme.headlineMedium,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user