feat: main page
This commit is contained in:
parent
2d29a2f38a
commit
8312429be3
@ -53,5 +53,12 @@ class ThemeApp {
|
|||||||
),
|
),
|
||||||
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
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 '../../../../common/theme/theme.dart';
|
||||||
import '../../../components/button/button.dart';
|
import '../../../components/button/button.dart';
|
||||||
|
import '../../../router/app_router.gr.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
class PinPage extends StatefulWidget {
|
class PinPage extends StatefulWidget {
|
||||||
@ -92,6 +93,8 @@ class _PinPageState extends State<PinPage> {
|
|||||||
_verifyPin(currentPin);
|
_verifyPin(currentPin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.router.push(MainRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
void _clearPinFields() {
|
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: RegisterRoute.page),
|
||||||
AutoRoute(page: OtpRoute.page),
|
AutoRoute(page: OtpRoute.page),
|
||||||
AutoRoute(page: PinRoute.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
|
// coverage:ignore-file
|
||||||
|
|
||||||
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
// ignore_for_file: no_leading_underscores_for_library_prefixes
|
||||||
import 'package:auto_route/auto_route.dart' as _i7;
|
import 'package:auto_route/auto_route.dart' as _i12;
|
||||||
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i1;
|
import 'package:enaklo/presentation/pages/auth/login/login_page.dart' as _i2;
|
||||||
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i3;
|
import 'package:enaklo/presentation/pages/auth/otp/otp_page.dart' as _i6;
|
||||||
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i4;
|
import 'package:enaklo/presentation/pages/auth/pin/pin_page.dart' as _i7;
|
||||||
import 'package:enaklo/presentation/pages/auth/register/register_page.dart'
|
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;
|
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'
|
import 'package:enaklo/presentation/pages/onboarding/onboarding_page.dart'
|
||||||
as _i2;
|
as _i4;
|
||||||
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i6;
|
import 'package:enaklo/presentation/pages/splash/splash_page.dart' as _i10;
|
||||||
import 'package:flutter/material.dart' as _i8;
|
import 'package:flutter/material.dart' as _i13;
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i1.LoginPage]
|
/// [_i1.HomePage]
|
||||||
class LoginRoute extends _i7.PageRouteInfo<void> {
|
class HomeRoute extends _i12.PageRouteInfo<void> {
|
||||||
const LoginRoute({List<_i7.PageRouteInfo>? children})
|
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);
|
: super(LoginRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'LoginRoute';
|
static const String name = 'LoginRoute';
|
||||||
|
|
||||||
static _i7.PageInfo page = _i7.PageInfo(
|
static _i12.PageInfo page = _i12.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i1.LoginPage();
|
return const _i2.LoginPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i2.OnboardingPage]
|
/// [_i3.MainPage]
|
||||||
class OnboardingRoute extends _i7.PageRouteInfo<void> {
|
class MainRoute extends _i12.PageRouteInfo<void> {
|
||||||
const OnboardingRoute({List<_i7.PageRouteInfo>? children})
|
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);
|
: super(OnboardingRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OnboardingRoute';
|
static const String name = 'OnboardingRoute';
|
||||||
|
|
||||||
static _i7.PageInfo page = _i7.PageInfo(
|
static _i12.PageInfo page = _i12.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i2.OnboardingPage();
|
return const _i4.OnboardingPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i3.OtpPage]
|
/// [_i5.OrderPage]
|
||||||
class OtpRoute extends _i7.PageRouteInfo<void> {
|
class OrderRoute extends _i12.PageRouteInfo<void> {
|
||||||
const OtpRoute({List<_i7.PageRouteInfo>? children})
|
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);
|
: super(OtpRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'OtpRoute';
|
static const String name = 'OtpRoute';
|
||||||
|
|
||||||
static _i7.PageInfo page = _i7.PageInfo(
|
static _i12.PageInfo page = _i12.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i3.OtpPage();
|
return const _i6.OtpPage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i4.PinPage]
|
/// [_i7.PinPage]
|
||||||
class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
class PinRoute extends _i12.PageRouteInfo<PinRouteArgs> {
|
||||||
PinRoute({
|
PinRoute({
|
||||||
_i8.Key? key,
|
_i13.Key? key,
|
||||||
bool isCreatePin = true,
|
bool isCreatePin = true,
|
||||||
String? title,
|
String? title,
|
||||||
List<_i7.PageRouteInfo>? children,
|
List<_i12.PageRouteInfo>? children,
|
||||||
}) : super(
|
}) : super(
|
||||||
PinRoute.name,
|
PinRoute.name,
|
||||||
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
args: PinRouteArgs(key: key, isCreatePin: isCreatePin, title: title),
|
||||||
@ -84,13 +141,13 @@ class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
|||||||
|
|
||||||
static const String name = 'PinRoute';
|
static const String name = 'PinRoute';
|
||||||
|
|
||||||
static _i7.PageInfo page = _i7.PageInfo(
|
static _i12.PageInfo page = _i12.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
final args = data.argsAs<PinRouteArgs>(
|
final args = data.argsAs<PinRouteArgs>(
|
||||||
orElse: () => const PinRouteArgs(),
|
orElse: () => const PinRouteArgs(),
|
||||||
);
|
);
|
||||||
return _i4.PinPage(
|
return _i7.PinPage(
|
||||||
key: args.key,
|
key: args.key,
|
||||||
isCreatePin: args.isCreatePin,
|
isCreatePin: args.isCreatePin,
|
||||||
title: args.title,
|
title: args.title,
|
||||||
@ -102,7 +159,7 @@ class PinRoute extends _i7.PageRouteInfo<PinRouteArgs> {
|
|||||||
class PinRouteArgs {
|
class PinRouteArgs {
|
||||||
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
const PinRouteArgs({this.key, this.isCreatePin = true, this.title});
|
||||||
|
|
||||||
final _i8.Key? key;
|
final _i13.Key? key;
|
||||||
|
|
||||||
final bool isCreatePin;
|
final bool isCreatePin;
|
||||||
|
|
||||||
@ -115,33 +172,65 @@ class PinRouteArgs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i5.RegisterPage]
|
/// [_i8.ProfilePage]
|
||||||
class RegisterRoute extends _i7.PageRouteInfo<void> {
|
class ProfileRoute extends _i12.PageRouteInfo<void> {
|
||||||
const RegisterRoute({List<_i7.PageRouteInfo>? children})
|
const ProfileRoute({List<_i12.PageRouteInfo>? children})
|
||||||
: super(RegisterRoute.name, initialChildren: 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,
|
name,
|
||||||
builder: (data) {
|
builder: (data) {
|
||||||
return const _i5.RegisterPage();
|
return const _i8.ProfilePage();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// generated route for
|
/// generated route for
|
||||||
/// [_i6.SplashPage]
|
/// [_i9.RegisterPage]
|
||||||
class SplashRoute extends _i7.PageRouteInfo<void> {
|
class RegisterRoute extends _i12.PageRouteInfo<void> {
|
||||||
const SplashRoute({List<_i7.PageRouteInfo>? children})
|
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);
|
: super(SplashRoute.name, initialChildren: children);
|
||||||
|
|
||||||
static const String name = 'SplashRoute';
|
static const String name = 'SplashRoute';
|
||||||
|
|
||||||
static _i7.PageInfo page = _i7.PageInfo(
|
static _i12.PageInfo page = _i12.PageInfo(
|
||||||
name,
|
name,
|
||||||
builder: (data) {
|
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