add flutter

This commit is contained in:
Ariska
2026-03-11 15:29:37 +07:00
parent c253e1a370
commit 619d758027
9490 changed files with 135801 additions and 1353 deletions
@@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:ontime_merchant_flutter/features/auth/application/auth_controller.dart';
class HomeShell extends ConsumerStatefulWidget {
const HomeShell({super.key});
@override
ConsumerState<HomeShell> createState() => _HomeShellState();
}
class _HomeShellState extends ConsumerState<HomeShell> {
int _index = 0;
@override
Widget build(BuildContext context) {
final merchant = ref.watch(authControllerProvider).merchant;
final pages = <Widget>[
const Center(child: Text('Toko pesanan & saldo')),
const Center(child: Text('Riwayat')),
const Center(child: Text('Chat')),
const Center(child: Text('Menu (kategori & item)')),
_ProfileTab(),
];
return Scaffold(
appBar: AppBar(
title: Text(merchant?.namaMerchant ?? 'Merchant'),
),
body: SafeArea(child: pages[_index]),
bottomNavigationBar: NavigationBar(
selectedIndex: _index,
onDestinationSelected: (i) => setState(() => _index = i),
destinations: const [
NavigationDestination(
icon: Icon(Icons.store_outlined),
selectedIcon: Icon(Icons.store),
label: 'Toko',
),
NavigationDestination(
icon: Icon(Icons.history),
selectedIcon: Icon(Icons.history),
label: 'Riwayat',
),
NavigationDestination(
icon: Icon(Icons.chat_outlined),
selectedIcon: Icon(Icons.chat),
label: 'Chat',
),
NavigationDestination(
icon: Icon(Icons.restaurant_menu_outlined),
selectedIcon: Icon(Icons.restaurant_menu),
label: 'Menu',
),
NavigationDestination(
icon: Icon(Icons.settings_outlined),
selectedIcon: Icon(Icons.settings),
label: 'Pengaturan',
),
],
),
);
}
}
class _ProfileTab extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ElevatedButton(
onPressed: () async {
ref.read(authControllerProvider.notifier).logout();
await AuthController.clearStored();
if (context.mounted) context.go('/auth/login');
},
child: const Text('Keluar'),
),
],
),
);
}
}