added user page, pimpinan page, e signature

This commit is contained in:
kicap
2023-08-03 17:58:40 +08:00
parent 30131e5ffe
commit 914e24706b
35 changed files with 2341 additions and 327 deletions

View File

@ -0,0 +1,95 @@
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 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../../app/themes/app_colors.dart';
import '../../../app/themes/app_text.dart';
import './user_index_tracking_view_model.dart';
class UserIndexTrackingView extends StatelessWidget {
const UserIndexTrackingView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return ViewModelBuilder<UserIndexTrackingViewModel>.reactive(
viewModelBuilder: () => UserIndexTrackingViewModel(),
onViewModelReady: (UserIndexTrackingViewModel model) async {
await model.init();
},
builder: (
BuildContext context,
UserIndexTrackingViewModel 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,
actions: [
IconButton(
onPressed: () {
model.login();
},
icon: const Icon(Icons.login, color: Colors.white),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
child: ExtendedNavigator(
navigatorKey: StackedService.nestedNavigationKey(5),
router: UserIndexTrackingViewRouter(),
initialRoute: UserIndexTrackingViewRoutes.danaSosialAdminView,
),
),
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,71 @@
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 UserIndexTrackingViewModel extends IndexTrackingViewModel {
final log = getLogger('PimpinanIndexTrackingViewModel');
final _navigationService = locator<NavigationService>();
// final _dialogService = locator<DialogService>();
String header = 'Dana Sosial';
final _bottomNavBarList = [
{
'name': 'Siswa',
'icon': Icons.people_alt_outlined,
'header': 'List Siswa'
},
{'name': 'Dana', 'icon': Icons.money, 'header': 'Dana Sosial'},
{
'name': 'Profil',
'icon': Icons.person_4_outlined,
'header': 'Profil Panti Asuhan'
},
{'name': 'V & M', 'icon': Icons.list_alt_rounded, 'header': 'Visi & Misi'},
{'name': 'Sejarah', 'icon': Icons.list_outlined, 'header': 'Sejarah'},
{
'name': 'S O',
'icon': Icons.people_alt_outlined,
'header': 'Struktur Organisasi'
},
];
List<Map<String, dynamic>> get bottomNavBarList => _bottomNavBarList;
final List<String> _views = [
UserIndexTrackingViewRoutes.dataSiswaView,
UserIndexTrackingViewRoutes.danaSosialAdminView,
UserIndexTrackingViewRoutes.profilView,
UserIndexTrackingViewRoutes.visiMisiView,
UserIndexTrackingViewRoutes.sejarahView,
UserIndexTrackingViewRoutes.strukturOrganisasiView
];
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: 5,
);
}
void login() {
_navigationService.navigateTo(
Routes.loginScreenView,
);
}
}