diff --git a/README.md b/README.md index f4636c0..f3fccb3 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,58 @@ # mone -A new Flutter project. +Aplikasi ini adalah proyek Flutter yang dirancang sebagai titik awal untuk membangun aplikasi mobile dan web. Proyek ini mendemonstrasikan penggunaan Flutter untuk menciptakan aplikasi yang dapat berjalan di berbagai platform. -## Getting Started +## Fitur -This project is a starting point for a Flutter application. +- Dukungan untuk berbagai platform: Android, iOS, Web, Windows, Linux, dan macOS. +- Struktur proyek yang terorganisir dengan baik untuk memudahkan pengembangan. +- Contoh penggunaan berbagai fitur Flutter. -A few resources to get you started if this is your first Flutter project: +## Prerequisites -- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) +Sebelum memulai, pastikan Anda telah menginstal: -For help getting started with Flutter development, view the -[online documentation](https://docs.flutter.dev/), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +- [Flutter](https://flutter.dev/docs/get-started/install) +- [Dart](https://dart.dev/get-dart) + +## Instalasi + +1. Clone repositori ini ke mesin lokal Anda: + ```bash + git clone https://github.com/mone-app/mone.git + cd mone + ``` + +2. Jalankan perintah berikut untuk menginstal dependensi: + ```bash + flutter pub get + ``` + +3. Untuk menjalankan aplikasi di emulator atau perangkat: + ```bash + flutter run + ``` + +## Pengembangan + +Jika Anda ingin berkontribusi pada proyek ini, silakan buat branch baru dan kirim pull request. Pastikan untuk mengikuti praktik terbaik pengembangan perangkat lunak. + +## Dokumentasi + +Untuk lebih memahami Flutter dan cara menggunakannya, Anda dapat merujuk ke dokumentasi resmi: +- [Dokumentasi Flutter](https://flutter.dev/docs) +- [Tutorial Flutter](https://flutter.dev/docs/get-started/codelab) + +## Kontribusi + +Kontribusi sangat diterima! Silakan buka isu atau kirim pull request jika Anda memiliki fitur atau perbaikan yang ingin ditambahkan. + +## Lisensi + +Proyek ini dilisensikan di bawah [Lisensi MIT](LICENSE). + +## Kontak + +Jika Anda memiliki pertanyaan atau saran, silakan hubungi: +- [Afiq Fawwaz Haidar](mailto:your-email@example.com) +- [Java Kanaya Prada](mailto:your-email@example.com) diff --git a/lib/dashboard_page.dart b/lib/dashboard_page.dart new file mode 100644 index 0000000..090f716 --- /dev/null +++ b/lib/dashboard_page.dart @@ -0,0 +1,21 @@ +// dashboard_page.dart + +import 'package:flutter/material.dart'; + +class DashboardPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Dashboard')), + body: Center( + child: Text('Selamat datang di Dashboard!'), + ), + floatingActionButton: FloatingActionButton( + onPressed: () { + // Navigasi ke halaman transaksi + }, + child: Icon(Icons.add), + ), + ); + } +} \ No newline at end of file diff --git a/lib/login.dart b/lib/login.dart new file mode 100644 index 0000000..1a62ac4 --- /dev/null +++ b/lib/login.dart @@ -0,0 +1,46 @@ +// login.dart + +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + @override + Widget build(BuildContext context) { + return MaterialApp( + home: LoginPage(), + ); + } +} + +class LoginPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Login')), + body: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + TextField( + decoration: InputDecoration(labelText: 'Username'), + ), + TextField( + decoration: InputDecoration(labelText: 'Password'), + obscureText: true, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + // Logic untuk login + }, + child: Text('Login'), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/login_page.dart b/lib/login_page.dart new file mode 100644 index 0000000..624e42e --- /dev/null +++ b/lib/login_page.dart @@ -0,0 +1,34 @@ +// login_page.dart + +import 'package:flutter/material.dart'; + +class LoginPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Login')), + body: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + TextField( + decoration: InputDecoration(labelText: 'Username'), + ), + TextField( + decoration: InputDecoration(labelText: 'Password'), + obscureText: true, + ), + SizedBox(height: 20), + ElevatedButton( + onPressed: () { + // Logic untuk login + Navigator.pushReplacementNamed(context, '/dashboard'); + }, + child: Text('Login'), + ), + ], + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index d7bdfb6..4bffcb7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,72 +1,124 @@ -import 'package:firebase_auth/firebase_auth.dart'; -import 'package:firebase_core/firebase_core.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:mone/core/services/navigation/navigation_service.dart'; -import 'package:mone/core/services/notification/fcm_service.dart'; -import 'package:mone/core/services/notification/notification_service.dart'; -import 'package:mone/data/enums/route_enum.dart'; -import 'package:mone/data/providers/user_provider.dart'; -import 'package:mone/firebase_options.dart'; -import 'package:mone/route.dart'; - -void main() async { - WidgetsFlutterBinding.ensureInitialized(); - - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); - await NotificationService.initializeLocalNotifications(debug: true); - await NotificationService.initializeRemoteNotifications(debug: true); - - runApp(const ProviderScope(child: App())); -} - -class App extends ConsumerStatefulWidget { - const App({super.key}); - - @override - ConsumerState createState() => _AppState(); -} - -class _AppState extends ConsumerState { - @override - void initState() { - super.initState(); - WidgetsBinding.instance.addPostFrameCallback((_) { - ref.read(userProvider.notifier).updateFcmToken(); - }); - } - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Mone', - navigatorKey: NavigationService.navigatorKey, - theme: ThemeData(), - onGenerateRoute: (settings) => AppRouter.onGenerateRoute(settings, ref), - initialRoute: RouteEnum.login, - builder: (context, child) { - return StreamBuilder( - stream: ref.read(authRepositoryProvider).auth.authStateChanges(), - builder: (context, authSnapshot) { - if (authSnapshot.connectionState == ConnectionState.waiting) { - return const Scaffold( - body: Center(child: CircularProgressIndicator()), - ); - } - - WidgetsBinding.instance.addPostFrameCallback((_) { - if (authSnapshot.hasData) { - FcmTokenService().updateFcmToken(); - NavigationService.replaceWith(RouteEnum.home); - } else { - NavigationService.replaceWith(RouteEnum.login); - } - }); - - return child ?? const SizedBox(); - }, - ); - }, - ); - } -} +//main.dart + +import 'package:flutter/material.dart'; + +void main() { + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // TRY THIS: Try running your application with "flutter run". You'll see + // the application has a purple toolbar. Then, without quitting the app, + // try changing the seedColor in the colorScheme below to Colors.green + // and then invoke "hot reload" (save your changes or press the "hot + // reload" button in a Flutter-supported IDE, or press "r" if you used + // the command line to start the app). + // + // Notice that the counter didn't reset back to zero; the application + // state is not lost during the reload. To reset the state, use hot + // restart instead. + // + // This works for code too, not just values: Most code changes can be + // tested with just a hot reload. + colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), + ), + home: const MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + const MyHomePage({super.key, required this.title}); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + State createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // TRY THIS: Try changing the color here to a specific color (to + // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar + // change color while the other colors stay the same. + backgroundColor: Theme.of(context).colorScheme.inversePrimary, + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also a layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + // + // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" + // action in the IDE, or press "p" in the console), to see the + // wireframe for each widget. + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text('You have pushed the button this many times:'), + Text( + '$_counter', + style: Theme.of(context).textTheme.headlineMedium, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: const Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/lib/split_bill_page.dart b/lib/split_bill_page.dart new file mode 100644 index 0000000..3f7dc68 --- /dev/null +++ b/lib/split_bill_page.dart @@ -0,0 +1,15 @@ +// split_bill_page.dart + +import 'package:flutter/material.dart'; + +class SplitBillPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Split Bill')), + body: Center( + child: Text('Halaman untuk membagi tagihan.'), + ), + ); + } +} \ No newline at end of file diff --git a/lib/transaction_page.dart b/lib/transaction_page.dart new file mode 100644 index 0000000..ffe1529 --- /dev/null +++ b/lib/transaction_page.dart @@ -0,0 +1,15 @@ +// transaction_page.dart + +import 'package:flutter/material.dart'; + +class TransactionPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('Transaksi')), + body: Center( + child: Text('Halaman untuk mencatat transaksi.'), + ), + ); + } +} \ No newline at end of file