feat: main page
This commit is contained in:
parent
2d29a2f38a
commit
8312429be3
@ -53,5 +53,12 @@ class ThemeApp {
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
bottomNavigationBarTheme: BottomNavigationBarThemeData(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
selectedItemColor: AppColor.primary,
|
||||
unselectedItemColor: AppColor.textSecondary,
|
||||
backgroundColor: AppColor.white,
|
||||
elevation: 4,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../../common/theme/theme.dart';
|
||||
import '../../../components/button/button.dart';
|
||||
import '../../../router/app_router.gr.dart';
|
||||
|
||||
@RoutePage()
|
||||
class PinPage extends StatefulWidget {
|
||||
@ -92,6 +93,8 @@ class _PinPageState extends State<PinPage> {
|
||||
_verifyPin(currentPin);
|
||||
}
|
||||
}
|
||||
|
||||
context.router.push(MainRoute());
|
||||
}
|
||||
|
||||
void _clearPinFields() {
|
||||
|
||||
24
lib/presentation/pages/main/main_page.dart
Normal file
24
lib/presentation/pages/main/main_page.dart
Normal file
@ -0,0 +1,24 @@
|
||||
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(), VoucherRoute(), OrderRoute(), ProfileRoute()],
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
builder: (context, child, pageController) => Scaffold(
|
||||
body: child,
|
||||
bottomNavigationBar: MainBottomNavbar(
|
||||
tabsRouter: AutoTabsRouter.of(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
12
lib/presentation/pages/main/pages/home/home_page.dart
Normal file
12
lib/presentation/pages/main/pages/home/home_page.dart
Normal file
@ -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('Home Page'));
|
||||
}
|
||||
}
|
||||
12
lib/presentation/pages/main/pages/order/order_page.dart
Normal file
12
lib/presentation/pages/main/pages/order/order_page.dart
Normal file
@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class OrderPage extends StatelessWidget {
|
||||
const OrderPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('Order Page'));
|
||||
}
|
||||
}
|
||||
12
lib/presentation/pages/main/pages/profile/profile_page.dart
Normal file
12
lib/presentation/pages/main/pages/profile/profile_page.dart
Normal file
@ -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('Profile Page'));
|
||||
}
|
||||
}
|
||||
12
lib/presentation/pages/main/pages/voucher/voucher_page.dart
Normal file
12
lib/presentation/pages/main/pages/voucher/voucher_page.dart
Normal file
@ -0,0 +1,12 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@RoutePage()
|
||||
class VoucherPage extends StatelessWidget {
|
||||
const VoucherPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(child: Text('Voucher Page'));
|
||||
}
|
||||
}
|
||||
39
lib/presentation/pages/main/widgets/bottom_navbar.dart
Normal file
39
lib/presentation/pages/main/widgets/bottom_navbar.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MainBottomNavbar extends StatelessWidget {
|
||||
final TabsRouter tabsRouter;
|
||||
const MainBottomNavbar({super.key, required this.tabsRouter});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
currentIndex: tabsRouter.activeIndex,
|
||||
onTap: (index) {
|
||||
tabsRouter.setActiveIndex(index);
|
||||
},
|
||||
items: const [
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Home',
|
||||
tooltip: 'Home',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.card_giftcard),
|
||||
label: 'Voucher',
|
||||
tooltip: 'Voucher',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.list),
|
||||
label: 'Pesanan',
|
||||
tooltip: 'Pesanan',
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
icon: Icon(Icons.person),
|
||||
label: 'Profil',
|
||||
tooltip: 'Profil',
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -16,5 +16,16 @@ class AppRouter extends RootStackRouter {
|
||||
AutoRoute(page: RegisterRoute.page),
|
||||
AutoRoute(page: OtpRoute.page),
|
||||
AutoRoute(page: PinRoute.page),
|
||||
|
||||
// Main
|
||||
AutoRoute(
|
||||
page: MainRoute.page,
|
||||
children: [
|
||||
AutoRoute(page: HomeRoute.page),
|
||||
AutoRoute(page: VoucherRoute.page),
|
||||
AutoRoute(page: OrderRoute.page),
|
||||
AutoRoute(page: ProfileRoute.page),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@ -9,73 +9,130 @@
|
||||
// coverage:ignore-file
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||
import 'package:auto_route/auto_route.dart' as _i7;
|
||||
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i1;
|
||||
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i3;
|
||||
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i4;
|
||||
import 'package:auto_route/auto_route.dart' as _i12;
|
||||
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2;
|
||||
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i6;
|
||||
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i7;
|
||||
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
||||
as _i9;
|
||||
import 'package:enaklo/presentation/pages/main/main_page.dart' as _i3;
|
||||
import 'package:enaklo/presentation/pages/main/pages/home/home_page.dart'
|
||||
as _i1;
|
||||
import 'package:enaklo/presentation/pages/main/pages/order/order_page.dart'
|
||||
as _i5;
|
||||
import 'package:enaklo/presentation/pages/main/pages/profile/profile_page.dart'
|
||||
as _i8;
|
||||
import 'package:enaklo/presentation/pages/main/pages/voucher/voucher_page.dart'
|
||||
as _i11;
|
||||
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
||||
as _i2;
|
||||
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i6;
|
||||
import 'package:flutter/material.dart' as _i8;
|
||||
as _i4;
|
||||
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i10;
|
||||
import 'package:flutter/material.dart' as _i13;
|
||||
|
||||
/// generated route for
|
||||
/// [_i1.LoginPage]
|
||||
class LoginRoute extends _i7.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i7.PageRouteInfo>? children})
|
||||
/// [_i1.HomePage]
|
||||
class HomeRoute extends _i12.PageRouteInfo<void> {
|
||||
const HomeRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(HomeRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'HomeRoute';
|
||||
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i1.HomePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.LoginPage]
|
||||
class LoginRoute extends _i12.PageRouteInfo<void> {
|
||||
const LoginRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(LoginRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'LoginRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i1.LoginPage();
|
||||
return const _i2.LoginPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i2.OnboardingPage]
|
||||
class OnboardingRoute extends _i7.PageRouteInfo<void> {
|
||||
const OnboardingRoute({List<_i7.PageRouteInfo>? children})
|
||||
/// [_i3.MainPage]
|
||||
class MainRoute extends _i12.PageRouteInfo<void> {
|
||||
const MainRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(MainRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'MainRoute';
|
||||
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i3.MainPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.OnboardingPage]
|
||||
class OnboardingRoute extends _i12.PageRouteInfo<void> {
|
||||
const OnboardingRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(OnboardingRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'OnboardingRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i2.OnboardingPage();
|
||||
return const _i4.OnboardingPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i3.OtpPage]
|
||||
class OtpRoute extends _i7.PageRouteInfo<void> {
|
||||
const OtpRoute({List<_i7.PageRouteInfo>? children})
|
||||
/// [_i5.OrderPage]
|
||||
class OrderRoute extends _i12.PageRouteInfo<void> {
|
||||
const OrderRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(OrderRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'OrderRoute';
|
||||
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.OrderPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.OtpPage]
|
||||
class OtpRoute extends _i12.PageRouteInfo<void> {
|
||||
const OtpRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(OtpRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'OtpRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i3.OtpPage();
|
||||
return const _i6.OtpPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i4.PinPage]
|
||||
class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
||||
/// [_i7.PinPage]
|
||||
class PinRoute extends _i12.PageRouteInfo<PinRouteArgs> {
|
||||
PinRoute({
|
||||
_i8.Key? key,
|
||||
_i13.Key? key,
|
||||
bool isCreatePin = true,
|
||||
String? title,
|
||||
List<_i7.PageRouteInfo>? children,
|
||||
List<_i12.PageRouteInfo>? children,
|
||||
}) : super(
|
||||
PinRoute.name,
|
||||
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
||||
@ -84,13 +141,13 @@ class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
||||
|
||||
static const String name = 'PinRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
final args = data.argsAs<PinRouteArgs>(
|
||||
orElse: () => const PinRouteArgs(),
|
||||
);
|
||||
return _i4.PinPage(
|
||||
return _i7.PinPage(
|
||||
key: args.key,
|
||||
isCreatePin: args.isCreatePin,
|
||||
title: args.title,
|
||||
@ -102,7 +159,7 @@ class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
||||
class PinRouteArgs {
|
||||
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
||||
|
||||
final _i8.Key? key;
|
||||
final _i13.Key? key;
|
||||
|
||||
final bool isCreatePin;
|
||||
|
||||
@ -115,33 +172,65 @@ class PinRouteArgs {
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i5.RegisterPage]
|
||||
class RegisterRoute extends _i7.PageRouteInfo<void> {
|
||||
const RegisterRoute({List<_i7.PageRouteInfo>? children})
|
||||
: super(RegisterRoute.name, initialChildren: children);
|
||||
/// [_i8.ProfilePage]
|
||||
class ProfileRoute extends _i12.PageRouteInfo<void> {
|
||||
const ProfileRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(ProfileRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'RegisterRoute';
|
||||
static const String name = 'ProfileRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i5.RegisterPage();
|
||||
return const _i8.ProfilePage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i6.SplashPage]
|
||||
class SplashRoute extends _i7.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i7.PageRouteInfo>? children})
|
||||
/// [_i9.RegisterPage]
|
||||
class RegisterRoute extends _i12.PageRouteInfo<void> {
|
||||
const RegisterRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(RegisterRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'RegisterRoute';
|
||||
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i9.RegisterPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i10.SplashPage]
|
||||
class SplashRoute extends _i12.PageRouteInfo<void> {
|
||||
const SplashRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(SplashRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'SplashRoute';
|
||||
|
||||
static _i7.PageInfo page = _i7.PageInfo(
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i6.SplashPage();
|
||||
return const _i10.SplashPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// generated route for
|
||||
/// [_i11.VoucherPage]
|
||||
class VoucherRoute extends _i12.PageRouteInfo<void> {
|
||||
const VoucherRoute({List<_i12.PageRouteInfo>? children})
|
||||
: super(VoucherRoute.name, initialChildren: children);
|
||||
|
||||
static const String name = 'VoucherRoute';
|
||||
|
||||
static _i12.PageInfo page = _i12.PageInfo(
|
||||
name,
|
||||
builder: (data) {
|
||||
return const _i11.VoucherPage();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user