pharmacy_mobile/lib/main.dart
2025-02-28 12:36:26 +08:00

123 lines
3.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:pharmacy_mobile/auth/auth_gate.dart';
import 'package:pharmacy_mobile/pages/add_category_page.dart';
import 'package:pharmacy_mobile/pages/add_generics_page.dart';
import 'package:pharmacy_mobile/pages/add_manufactorer.dart';
import 'package:pharmacy_mobile/pages/add_medicine_page.dart';
import 'package:pharmacy_mobile/pages/add_stock_page.dart';
import 'package:pharmacy_mobile/pages/add_type_page.dart';
import 'package:pharmacy_mobile/pages/customer_page.dart';
import 'package:pharmacy_mobile/pages/customer_pages/customer_itemview_page.dart';
import 'package:pharmacy_mobile/pages/delete_stock_page.dart';
import 'package:pharmacy_mobile/pages/list_stocks_page.dart';
import 'package:pharmacy_mobile/pages/login_page.dart';
import 'package:go_router/go_router.dart';
import 'package:pharmacy_mobile/pages/main_page.dart';
import 'package:pharmacy_mobile/pages/register_page.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
final supUrl = "https://lijihnvjlucyvxfhghqd.supabase.co";
final supAnonkey =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxpamlobnZqbHVjeXZ4ZmhnaHFkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjQ1NjEyODYsImV4cCI6MjA0MDEzNzI4Nn0.N3_FLKm02OdprL9m3P0CzuV8kdbCrrJKaVdtgVR3PSk";
await Supabase.initialize(
url: supUrl,
anonKey: supAnonkey,
);
runApp(MyApp());
}
final _router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
name: 'index',
path: '/',
builder: (context, state) => const AuthGate(),
),
GoRoute(
name: 'login',
path: '/login',
builder: (context, state) => const LoginPage(),
),
GoRoute(
name: 'register',
path: '/register',
builder: (context, state) => const RegisterPage(),
),
GoRoute(
name: 'main',
path: '/main',
builder: (context, state) => const MainPage(),
),
GoRoute(
name: 'addmanufactorer',
path: '/addmanufactorer',
builder: (context, state) => const AddManufactorerPage(),
),
GoRoute(
name: 'addmedicines',
path: '/addmedicines',
builder: (context, state) => const AddMedicinePage(),
),
GoRoute(
name: 'addgenerics',
path: '/addgenerics',
builder: (context, state) => const AddGenericsPage(),
),
GoRoute(
name: 'addtype',
path: '/addtype',
builder: (context, state) => const AddTypePage(),
),
GoRoute(
name: 'addcategory',
path: '/addcategory',
builder: (context, state) => const AddCategoryPage(),
),
GoRoute(
name: 'addstock',
path: '/addstock',
builder: (context, state) => const AddStockPage(),
),
GoRoute(
name: 'liststocks',
path: '/liststocks',
builder: (context, state) => const ListStocksPage(),
),
GoRoute(
name: 'deletestock',
path: '/deletestock',
builder: (context, state) => const DeleteStockPage(),
),
GoRoute(
name: 'customer',
path: '/customer',
builder: (context, state) => const CustomerPage(),
),
GoRoute(
name: 'itemview',
path: '/itemview',
builder: (context, state) => const CustomerItemviewPage(),
),
],
);
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
),
routerConfig: _router,
);
}
}