added safe area and pemilih detail bottom sheet
This commit is contained in:
@ -7,10 +7,12 @@
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import 'app.locator.dart';
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_history/detail_suara_pemilih_bottom_sheet/detail_suara_pemilih_bottom_sheet_view.dart';
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_survei/bottom_sheet_cari_area/bottom_sheet_cari_area_view.dart';
|
||||
|
||||
enum BottomSheetType {
|
||||
bottomSheetCariAreaView,
|
||||
detailSuaraPemilihBottomSheetView,
|
||||
}
|
||||
|
||||
void setupBottomSheetUi() {
|
||||
@ -19,6 +21,9 @@ void setupBottomSheetUi() {
|
||||
final Map<BottomSheetType, SheetBuilder> builders = {
|
||||
BottomSheetType.bottomSheetCariAreaView: (context, request, completer) =>
|
||||
BottomSheetCariAreaView(request: request, completer: completer),
|
||||
BottomSheetType.detailSuaraPemilihBottomSheetView:
|
||||
(context, request, completer) => DetailSuaraPemilihBottomSheetView(
|
||||
request: request, completer: completer),
|
||||
};
|
||||
|
||||
bottomsheetService.setCustomSheetBuilders(builders);
|
||||
|
@ -14,6 +14,7 @@ import '../ui/views/tim_survei_index_tracking/halaman_history/halaman_history_vi
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_pengaturan/halaman_pengaturan_view.dart';
|
||||
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_survei/bottom_sheet_cari_area/bottom_sheet_cari_area_view.dart';
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_history/detail_suara_pemilih_bottom_sheet/detail_suara_pemilih_bottom_sheet_view.dart';
|
||||
import '../ui/views/tim_survei_index_tracking/halaman_survei/halaman_survei_view.dart';
|
||||
import '../ui/views/tim_survei_index_tracking/tim_survei_index_tracking_view.dart';
|
||||
|
||||
@ -51,6 +52,7 @@ import '../ui/views/tim_survei_index_tracking/tim_survei_index_tracking_view.dar
|
||||
logger: StackedLogger(),
|
||||
bottomsheets: [
|
||||
StackedBottomsheet(classType: BottomSheetCariAreaView),
|
||||
StackedBottomsheet(classType: DetailSuaraPemilihBottomSheetView)
|
||||
],
|
||||
)
|
||||
class App {}
|
||||
|
@ -22,65 +22,67 @@ class SplashScreenView extends StatelessWidget {
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: warningColor,
|
||||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Expanded(
|
||||
flex: 1,
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
body: SafeArea(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Expanded(
|
||||
flex: 1,
|
||||
child: SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'SISTEM CEK SUARA',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontSize: 20,
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'(Survei App)',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Expanded(child: SizedBox()),
|
||||
Text(
|
||||
'Created By',
|
||||
style: regularTextStyle.copyWith(
|
||||
fontSize: 12,
|
||||
Text(
|
||||
'SISTEM CEK SUARA',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontSize: 20,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'Kicap Karan',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
fontStyle: FontStyle.italic,
|
||||
Text(
|
||||
'(Survei App)',
|
||||
style: boldTextStyle.copyWith(
|
||||
// color: backgroundColor,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'www.kicap-karan.com',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
const Expanded(child: SizedBox()),
|
||||
Text(
|
||||
'Created By',
|
||||
style: regularTextStyle.copyWith(
|
||||
fontSize: 12,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
Text(
|
||||
'Kicap Karan',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
fontStyle: FontStyle.italic,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Text(
|
||||
'www.kicap-karan.com',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -0,0 +1,157 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../../../../../app/themes/app_colors.dart';
|
||||
import '../../../../../app/themes/app_text.dart';
|
||||
import './detail_suara_pemilih_bottom_sheet_view_model.dart';
|
||||
|
||||
class DetailSuaraPemilihBottomSheetView extends StatelessWidget {
|
||||
final SheetRequest request;
|
||||
final Function(SheetResponse)? completer;
|
||||
|
||||
const DetailSuaraPemilihBottomSheetView({
|
||||
Key? key,
|
||||
required this.request,
|
||||
this.completer,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<DetailSuaraPemilihBottomSheetViewModel>.reactive(
|
||||
viewModelBuilder: () => DetailSuaraPemilihBottomSheetViewModel(),
|
||||
onViewModelReady: (DetailSuaraPemilihBottomSheetViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
DetailSuaraPemilihBottomSheetViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.all(20),
|
||||
alignment: Alignment.topCenter,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16.0),
|
||||
topRight: Radius.circular(16.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
request.title!,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Container(
|
||||
height: 100,
|
||||
width: 150,
|
||||
decoration: BoxDecoration(
|
||||
color: mainColor,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
model.showImage(
|
||||
context,
|
||||
dotenv.env['url']! + request.data!.img!,
|
||||
);
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.network(
|
||||
dotenv.env['url']! + request.data!.img!,
|
||||
fit: BoxFit.fill,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error,
|
||||
color: backgroundColor,
|
||||
size: 50,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'Nama',
|
||||
value: request.data!.namaPemilih!,
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'No KTP /\nNo HP',
|
||||
value: request.data!.nikNomorHp!,
|
||||
),
|
||||
_DetailChildWidget(
|
||||
title: 'Tanggal/\nWaktu',
|
||||
value: request.data!.createdAt!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _DetailChildWidget extends StatelessWidget {
|
||||
const _DetailChildWidget({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.value,
|
||||
}) : super(key: key);
|
||||
final String title;
|
||||
final String value;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Text(
|
||||
title,
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
' : ',
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Text(
|
||||
value,
|
||||
style: italicTextStyle.copyWith(
|
||||
fontSize: 16,
|
||||
color: fontColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
import 'package:easy_image_viewer/easy_image_viewer.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../../app/app.logger.dart';
|
||||
import '../../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
class DetailSuaraPemilihBottomSheetViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('DetailSuaraPemilihBottomSheetViewModel');
|
||||
Future<void> init() async {}
|
||||
|
||||
showImage(BuildContext context, String? url) async {
|
||||
log.i(url);
|
||||
showImageViewer(
|
||||
context,
|
||||
Image.network(
|
||||
url!,
|
||||
fit: BoxFit.fill,
|
||||
).image,
|
||||
swipeDismissible: true,
|
||||
doubleTapZoomable: true,
|
||||
);
|
||||
}
|
||||
}
|
@ -113,7 +113,9 @@ class HalamanHistoryView extends StatelessWidget {
|
||||
color: mainColor,
|
||||
),
|
||||
onPressed: () {
|
||||
// model.showDetailCaleg(model.listCalegModel[i]);
|
||||
model.showDetailPemilih(
|
||||
model.listPemilih[i],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
@ -1,6 +1,7 @@
|
||||
import 'package:cek_suara_app/model/my_response.model.dart';
|
||||
import 'package:cek_suara_app/model/pemilih_model.dart';
|
||||
|
||||
import '../../../../app/app.bottomsheets.dart';
|
||||
import '../../../../app/app.logger.dart';
|
||||
import '../../../../app/core/custom_base_view_model.dart';
|
||||
|
||||
@ -37,4 +38,14 @@ class HalamanHistoryViewModel extends CustomBaseViewModel {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
showDetailPemilih(PemilihModel listPemilih) async {
|
||||
await bottomSheetService.showCustomSheet(
|
||||
variant: BottomSheetType.detailSuaraPemilihBottomSheetView,
|
||||
title: 'Detail Suara Pemilih',
|
||||
description: 'Detail Suara Pemilih',
|
||||
// isScrollControlled: true,
|
||||
data: listPemilih,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -55,9 +55,12 @@ class HalamanSurveiView extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: model.imageBytes != null
|
||||
? Image.memory(
|
||||
model.imageBytes!,
|
||||
fit: BoxFit.fill,
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.memory(
|
||||
model.imageBytes!,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
)
|
||||
: const Icon(
|
||||
Icons.credit_card_rounded,
|
||||
|
@ -24,45 +24,47 @@ class TimSurveiIndexTrackingView extends StatelessWidget {
|
||||
TimSurveiIndexTrackingViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
extendBody: false,
|
||||
body: ExtendedNavigator(
|
||||
router: TimSurveiIndexTrackingViewRouter(),
|
||||
navigatorKey: StackedService.nestedNavigationKey(5),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor,
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
extendBody: false,
|
||||
body: ExtendedNavigator(
|
||||
router: TimSurveiIndexTrackingViewRouter(),
|
||||
navigatorKey: StackedService.nestedNavigationKey(5),
|
||||
),
|
||||
bottomNavigationBar: StylishBottomBar(
|
||||
items: [
|
||||
for (var item in model.bottomNavBarList)
|
||||
BottomBarItem(
|
||||
icon: Icon(item['icon'],
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor),
|
||||
title: Text(
|
||||
item['name'],
|
||||
style: regularTextStyle.copyWith(
|
||||
color: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? warningColor
|
||||
: fontColor,
|
||||
),
|
||||
// textAlign: TextAlign.l,
|
||||
),
|
||||
// textAlign: TextAlign.l,
|
||||
backgroundColor: model.currentIndex ==
|
||||
model.bottomNavBarList.indexOf(item)
|
||||
? fontColor
|
||||
: fontColor,
|
||||
),
|
||||
backgroundColor:
|
||||
model.currentIndex == model.bottomNavBarList.indexOf(item)
|
||||
? fontColor
|
||||
: fontColor,
|
||||
),
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: warningColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
],
|
||||
currentIndex: model.currentIndex,
|
||||
option: BubbleBarOptions(),
|
||||
hasNotch: true,
|
||||
backgroundColor: warningColor,
|
||||
onTap: (value) {
|
||||
model.handleNavigation(value);
|
||||
},
|
||||
// fabLocation: StylishBarFabLocation.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -193,6 +193,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.3.3"
|
||||
easy_image_viewer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: easy_image_viewer
|
||||
sha256: "8d11a4630e9beb7aacf043c98da2dd4b3bc3b47aa4073d2016ba696376161272"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -52,6 +52,7 @@ dependencies:
|
||||
http_parser:
|
||||
intl:
|
||||
shared_preferences:
|
||||
easy_image_viewer:
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user