first commit

This commit is contained in:
kicap
2023-03-30 15:34:12 +08:00
commit b82edc2db9
157 changed files with 6948 additions and 0 deletions

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import './admin_index_view_model.dart';
class AdminIndexView extends StatelessWidget {
const AdminIndexView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<AdminIndexViewModel>.reactive(
viewModelBuilder: () => AdminIndexViewModel(),
onViewModelReady: (AdminIndexViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
AdminIndexViewModel model,
Widget? child,
) {
return const Scaffold(
body: Center(
child: Text(
'AdminIndexView asdas asda aasdsda a',
),
),
);
},
);
}
}

View File

@ -0,0 +1,5 @@
import 'package:panti_asuhan/app/core/custom_base_view_model.dart';
class AdminIndexViewModel extends CustomBaseViewModel {
Future<void> init() async {}
}

View File

@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../../app/app.router.dart';
import '../../../app/themes/app_colors.dart';
import '../../../app/themes/app_text.dart';
import './admin_index_tracking_view_model.dart';
class AdminIndexTrackingView extends StatelessWidget {
const AdminIndexTrackingView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<AdminIndexTrackingViewModel>.reactive(
viewModelBuilder: () => AdminIndexTrackingViewModel(),
onViewModelReady: (AdminIndexTrackingViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
AdminIndexTrackingViewModel model,
Widget? child,
) {
return Scaffold(
appBar: AppBar(
title: Text(
model.header,
style: const TextStyle(
color: Colors.white,
fontSize: 20,
),
),
backgroundColor: mainColor,
elevation: 0,
automaticallyImplyLeading: false,
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(3),
router: AdminIndexTrackingViewRouter(),
),
),
bottomNavigationBar: StylishBottomBar(
items: [
for (var item in model.bottomNavBarList)
BottomBarItem(
icon: Icon(item['icon'],
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: backgroundColor),
title: Text(
item['name'],
style: regularTextStyle.copyWith(
color: model.currentIndex ==
model.bottomNavBarList.indexOf(item)
? sixthGrey
: Colors.grey,
),
),
backgroundColor:
model.currentIndex == model.bottomNavBarList.indexOf(item)
? Colors.white
: Colors.grey,
),
],
currentIndex: model.currentIndex,
hasNotch: true,
backgroundColor: mainColor,
onTap: (value) {
model.handleNavigation(value);
},
option: BubbleBarOptions(
barStyle: BubbleBarStyle.horizotnal,
bubbleFillStyle: BubbleFillStyle.fill,
opacity: 0.3),
),
);
},
);
}
}

View File

@ -0,0 +1,54 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/app.router.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import '../../../app/app.locator.dart';
import '../../../app/app.logger.dart';
class AdminIndexTrackingViewModel extends IndexTrackingViewModel {
final log = getLogger('AdminIndexTrackingViewModel');
final _navigationService = locator<NavigationService>();
final _bottomNavBarList = [
{
'name': 'Siswa',
'icon': Icons.people_alt_outlined,
'header': 'List Siswa'
},
{'name': 'Dana Sosial', 'icon': Icons.money, 'header': 'Dana Sosial'},
{
'name': 'Profil',
'icon': Icons.list_alt_rounded,
'header': 'Profil Panti Asuhan'
}
];
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
final List<String> _views = [
AdminIndexTrackingViewRoutes.dataSiswaView,
AdminIndexTrackingViewRoutes.danaSosialAdminView,
AdminIndexTrackingViewRoutes.profilView,
];
String header = 'Dana Sosial';
Future<void> init() async {
setIndex(1);
}
void handleNavigation(int index) {
log.d("handleNavigation: $index");
log.d("currentIndex: $currentIndex");
if (currentIndex == index) return;
setIndex(index);
header = _bottomNavBarList[index]['header'] as String;
_navigationService.navigateTo(
_views[index],
id: 3,
);
}
}

View File

@ -0,0 +1,124 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/themes/app_colors.dart';
import 'package:stacked/stacked.dart';
import '../../../../app/themes/app_text.dart';
import './dana_sosial_admin_view_model.dart';
class DanaSosialAdminView extends StatelessWidget {
const DanaSosialAdminView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<DanaSosialAdminViewModel>.reactive(
viewModelBuilder: () => DanaSosialAdminViewModel(),
onViewModelReady: (DanaSosialAdminViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
DanaSosialAdminViewModel model,
Widget? child,
) {
return Scaffold(
body: Column(
children: [
Container(
padding:
const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
width: double.infinity,
decoration: BoxDecoration(
color: mainColor,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: mainGrey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset:
const Offset(0, 3), // changes position of shadow
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Dana Sosial Bulan Ini',
style: boldTextStyle.copyWith(
color: Colors.white,
fontSize: 20,
),
),
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Total Dana Sosial',
style: regularTextStyle.copyWith(
color: Colors.white,
fontSize: 15,
),
),
Text(
'Rp. 1.000.000',
style: regularTextStyle.copyWith(
color: Colors.white,
fontSize: 15,
),
),
],
),
],
),
),
const SizedBox(height: 25),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: mainGrey.withOpacity(0.5),
spreadRadius: 5,
blurRadius: 7,
offset:
const Offset(0, 3), // changes position of shadow
),
],
),
child: ListView.builder(
padding: const EdgeInsets.symmetric(
horizontal: 15, vertical: 10),
itemCount: 20,
itemBuilder: (context, index) {
return Card(
child: GestureDetector(
onTap: () {
model.log.i('Card $index tapped');
},
child: ListTile(
title: Text('1/02/15 - 10.00 am',
style: boldTextStyle.copyWith(
fontSize: 13, color: mainColor)),
subtitle: Text('Progress $index'),
trailing: Text('Pembangunan $index'),
),
),
);
},
),
),
),
],
),
floatingActionButton: const FloatingActionButton(
onPressed: null,
child: Icon(Icons.add),
));
},
);
}
}

View File

@ -0,0 +1,8 @@
import 'package:panti_asuhan/app/core/custom_base_view_model.dart';
import '../../../../app/app.logger.dart';
class DanaSosialAdminViewModel extends CustomBaseViewModel {
final log = getLogger('DanaSosialAdminViewModel');
Future<void> init() async {}
}

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import './data_siswa_view_model.dart';
class DataSiswaView extends StatelessWidget {
const DataSiswaView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<DataSiswaViewModel>.reactive(
viewModelBuilder: () => DataSiswaViewModel(),
onViewModelReady: (DataSiswaViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
DataSiswaViewModel model,
Widget? child,
) {
return const Scaffold(
body: Center(
child: Text(
'DataSiswaView',
),
),
);
},
);
}
}

View File

@ -0,0 +1,5 @@
import 'package:panti_asuhan/app/core/custom_base_view_model.dart';
class DataSiswaViewModel extends CustomBaseViewModel {
Future<void> init() async {}
}

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import './profil_view_model.dart';
class ProfilView extends StatelessWidget {
const ProfilView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<ProfilViewModel>.reactive(
viewModelBuilder: () => ProfilViewModel(),
onViewModelReady: (ProfilViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
ProfilViewModel model,
Widget? child,
) {
return const Scaffold(
body: Center(
child: Text(
'ProfilView',
),
),
);
},
);
}
}

View File

@ -0,0 +1,5 @@
import 'package:panti_asuhan/app/core/custom_base_view_model.dart';
class ProfilViewModel extends CustomBaseViewModel {
Future<void> init() async {}
}

View File

@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/ui/widgets/my_button.dart';
import 'package:panti_asuhan/ui/widgets/my_textformfield.dart';
import 'package:stacked/stacked.dart';
import '../../../app/themes/app_text.dart';
import './login_screen_view_model.dart';
class LoginScreenView extends StatelessWidget {
const LoginScreenView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<LoginScreenViewModel>.reactive(
viewModelBuilder: () => LoginScreenViewModel(),
onViewModelReady: (LoginScreenViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
LoginScreenViewModel model,
Widget? child,
) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.2,
),
// show the logo.png
const Center(
child: Image(
image: AssetImage("assets/logo.png"),
width: 150,
height: 150,
),
),
const SizedBox(height: 10),
Text(
"SILAHKAN LOGIN",
style: boldTextStyle.copyWith(
fontSize: 18,
),
),
const SizedBox(
height: 10,
),
const MyTextFormField(
hintText: "Username",
prefixIcon: Icon(Icons.person),
// controller: model.usernameController,
),
const SizedBox(
height: 10,
),
const MyTextFormField(
hintText: "Password",
prefixIcon: Icon(Icons.lock),
// controller: model.passwordController,
),
const SizedBox(
height: 10,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.5,
child: MyButton(
text: "LOGIN",
onPressed: () {
model.goToAdmin();
},
),
),
],
),
),
);
},
);
}
}

View File

@ -0,0 +1,13 @@
import '../../../app/app.logger.dart';
import '../../../app/app.router.dart';
import '../../../app/core/custom_base_view_model.dart';
class LoginScreenViewModel extends CustomBaseViewModel {
final log = getLogger('LoginScreenViewModel');
Future<void> init() async {}
goToAdmin() {
log.d('goToAdmin');
navigationService.navigateTo(Routes.adminIndexTrackingView);
}
}

View File

@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:panti_asuhan/app/themes/app_text.dart';
import 'package:stacked/stacked.dart';
import './splash_screen_view_model.dart';
class SplashScreenView extends StatelessWidget {
const SplashScreenView({super.key});
@override
Widget build(BuildContext context) {
return ViewModelBuilder<SplashScreenViewModel>.nonReactive(
viewModelBuilder: () => SplashScreenViewModel(),
onViewModelReady: (SplashScreenViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
SplashScreenViewModel model,
Widget? child,
) {
return Scaffold(
// backgroundColor: mainColor,
body: Column(
children: [
const SizedBox(),
Expanded(
child: Center(
// show the logo.png
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Image(
image: AssetImage("assets/logo.png"),
width: 200,
height: 200,
),
const SizedBox(height: 10),
Text(
"PANTI ASUHAN ABADI AISYIYAH",
style: boldTextStyle.copyWith(
fontSize: 20,
),
)
],
),
),
),
const Text(
"Jln Panti Asuhan No. 3 Ujung Lare, Kec. Soreang, Kota Parepare, Sulawesi Selatan 91133",
textAlign: TextAlign.center,
style: regularTextStyle,
),
const SizedBox(height: 15),
],
),
);
},
);
}
}

View File

@ -0,0 +1,14 @@
import '../../../app/app.logger.dart';
import '../../../app/app.router.dart';
import '../../../app/core/custom_base_view_model.dart';
class SplashScreenViewModel extends CustomBaseViewModel {
final log = getLogger('SplashScreenViewModel');
Future<void> init() async {
// wait 2 seconds then navigate to login
await Future.delayed(const Duration(seconds: 2));
await navigationService.navigateTo(
Routes.loginScreenView,
);
}
}