add initial take photo

This commit is contained in:
Dian Bayu Nugroho 2024-02-05 18:10:28 +07:00
parent 0b754bf939
commit 1616f22925
5 changed files with 299 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -10,6 +10,7 @@ class PathAssets {
static const String iconGoogle = 'assets/icons/icon-google.png'; static const String iconGoogle = 'assets/icons/icon-google.png';
static const String icon1 = 'assets/icons/icon-1.png'; static const String icon1 = 'assets/icons/icon-1.png';
static const String iconConnect = 'assets/icons/icon-connect.png'; static const String iconConnect = 'assets/icons/icon-connect.png';
static const String iconShield = 'assets/icons/icon-shield.png';
/// IMAGE /// IMAGE
static const String imgSplashLogo = 'assets/images/splash-logo.png'; static const String imgSplashLogo = 'assets/images/splash-logo.png';

View File

@ -0,0 +1,176 @@
import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:flutter/material.dart';
class ItemSelectForm {
final String key;
final String text;
final String? description;
final bool isOther;
final String image;
ItemSelectForm(
this.key,
this.text, {
this.isOther = false,
this.image = "",
this.description,
});
}
class SelectFormView extends StatelessWidget {
final String name;
final String? hintText;
final TextStyle? hintTextStyle;
final TextEditingController? ctrl;
final Widget? bottomSheetTitle;
final List<ItemSelectForm> listItem;
final ValueChanged<String> onSelect;
final FormFieldValidator<String>? validator;
final _borderRadius = const Radius.circular(24);
final bool? enabled;
const SelectFormView(
{Key? key,
required this.name,
this.hintText,
this.hintTextStyle,
this.ctrl,
this.bottomSheetTitle,
required this.listItem,
required this.onSelect,
this.validator,
this.enabled})
: super(key: key);
@override
Widget build(BuildContext context) {
bottomSheet() {
showModalBottomSheet<void>(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: _borderRadius,
topRight: _borderRadius,
),
),
builder: (BuildContext context) {
ItemSelectForm? selectedForm;
String? selectedKey;
if (listItem.isNotEmpty) {
var res = listItem.where((element) => element.key == selectedKey);
if (res.isNotEmpty) {
selectedForm = res.first;
}
}
return StatefulBuilder(builder: (
BuildContext context,
StateSetter stateSetter,
) {
return Container(
height: SizeConfig.height * .45,
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
bottomSheetTitle ?? Container(),
// const SizedBox(height: 16),
Expanded(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
...listItem.map(
(e) => Card(
elevation: 0,
color: Colors.transparent,
shape: const RoundedRectangleBorder(
side: BorderSide(
color: ColorPalette.greyBorder,
),
borderRadius:
BorderRadius.all(Radius.circular(12)),
),
child: ListTile(
title: Text(
e.text,
style: const TextStyle(
fontSize: 14,
),
),
subtitle: e.description != null
? Text(
e.description!,
maxLines: 2,
overflow: TextOverflow.ellipsis,
)
: null,
// trailing: const Icon(
// Icons.check_circle,
// color: ColorPalette.primary,
// ),
trailing: Radio(
focusColor: ColorPalette.primary,
activeColor: ColorPalette.primary,
visualDensity: const VisualDensity(
horizontal: VisualDensity.minimumDensity,
vertical: VisualDensity.minimumDensity,
),
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
value: e.key,
groupValue: selectedKey,
onChanged: (value) {
// selectedForm =
// ItemSelectForm(e.key, e.text);
// stateSetter(() {
// selectedKey = selectedForm!.key;
// });
},
),
onTap: () {
ctrl?.text = e.text;
onSelect(e.key);
Navigator.of(context).pop();
},
),
),
),
],
),
),
),
ButtonView(
name: 'Select',
marginVertical: 4.0,
onPressed: () {
// print('object $')
},
)
],
),
);
});
},
);
}
return TextFormView(
name: name,
readOnly: true,
enabled: enabled ?? true,
onTap: () {
if (listItem.isNotEmpty) bottomSheet();
},
validator: validator,
hintText: hintText,
hintTextStyle: hintTextStyle,
ctrl: ctrl,
suffixIcon: Icon(
Icons.keyboard_arrow_down,
size: SizeConfig.width * .07,
),
);
}
}

View File

@ -0,0 +1,91 @@
import 'package:cims_apps/application/assets/path_assets.dart';
import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/image/image_view.dart';
import 'package:cims_apps/application/component/text_caption/text_caption.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:flutter/material.dart';
class InitialTakePhoto extends StatelessWidget {
const InitialTakePhoto({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
List listImg = [
{'urlImg': PathAssets.imgKtpBlur, 'tag': 'Blurry Photo'},
{'urlImg': PathAssets.imgKtpLight, 'tag': 'Light Reflection'},
{'urlImg': PathAssets.imgKtpCropped, 'tag': 'Cropped Photo'},
{'urlImg': PathAssets.imgKtpClear, 'tag': 'Clear Photo'},
];
return SizedBox(
height: SizeConfig.height * .75,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const TextCaption(
title: 'Take a photo your ID card',
subtitle:
'Make sure your photo is clearly legible for identity verification purposes',
),
SizedBox(
width: SizeConfig.height,
child: Wrap(
alignment: WrapAlignment.spaceBetween,
spacing: 10,
runSpacing: 10,
children: List.generate(listImg.length, (index) {
final urlList = listImg[index]['urlImg'];
final tag = listImg[index]['tag'];
return Column(
children: [
ImageView(
image: urlList,
width: SizeConfig.width * .42,
),
const SizedBox(
height: 8,
),
Text(
tag,
style: const TextStyle(
color: ColorPalette.slate800,
fontWeight: FontWeight.w600),
),
],
);
}),
),
),
// const Spacer(),
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
ImageView(
image: PathAssets.iconShield,
width: 20,
height: 22,
),
SizedBox(
width: 8,
),
Expanded(
child: Text(
'In accordance with OJK regulations, an ID card is required to purchase mutual funds.',
style: TextStyle(
fontWeight: FontWeight.w600,
color: ColorPalette.primary,
),
),
)
],
),
ButtonView(
name: 'Take a Photo',
marginVertical: 16.0,
onPressed: () {},
)
],
),
);
}
}

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
class SubmissionDataViewModel extends ChangeNotifier {
int currentStep = 1;
int stepAmount = 9;
bool _isEmailVerify = false;
bool get isEmailVerify => _isEmailVerify;
submitEmail() {
_isEmailVerify = !_isEmailVerify;
notifyListeners();
}
onWillPopSubmission(BuildContext context) {
if (currentStep != 1) {
currentStep--;
notifyListeners();
} else {
Navigator.of(context).pop(true);
}
}
nextSubmission(BuildContext context) {
if (currentStep < stepAmount) {
currentStep++;
} else {
//ToDo : Go To next step after completing the submission
}
notifyListeners();
}
}