Compare commits
11 Commits
main
...
6e2516d9c8
Author | SHA1 | Date | |
---|---|---|---|
6e2516d9c8 | |||
e538fa5927 | |||
7ec266cded | |||
4b4b42beae | |||
dacf5461f3 | |||
5d4bc47adf | |||
80e4657240 | |||
e63e5588fb | |||
ff1886cec1 | |||
1616f22925 | |||
0b754bf939 |
BIN
assets/icons/icon-flag.png
Normal file
BIN
assets/icons/icon-flag.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
assets/icons/icon-shield.png
Normal file
BIN
assets/icons/icon-shield.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
BIN
assets/images/img-success-signup.png
Normal file
BIN
assets/images/img-success-signup.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
@@ -10,6 +10,8 @@ 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';
|
||||||
|
static const String iconFlag = 'assets/icons/icon-flag.png';
|
||||||
|
|
||||||
/// IMAGE
|
/// IMAGE
|
||||||
static const String imgSplashLogo = 'assets/images/splash-logo.png';
|
static const String imgSplashLogo = 'assets/images/splash-logo.png';
|
||||||
@@ -22,4 +24,5 @@ class PathAssets {
|
|||||||
static const String imgKtpCropped = 'assets/images/img-ktp-cropped.png';
|
static const String imgKtpCropped = 'assets/images/img-ktp-cropped.png';
|
||||||
static const String imgKtpClear = 'assets/images/img-ktp-clear.png';
|
static const String imgKtpClear = 'assets/images/img-ktp-clear.png';
|
||||||
static const String imgKtpBlur = 'assets/images/img-ktp-blur.png';
|
static const String imgKtpBlur = 'assets/images/img-ktp-blur.png';
|
||||||
|
static const String imgSuccessSignup = 'assets/images/img-success-signup.png';
|
||||||
}
|
}
|
||||||
|
@@ -55,8 +55,9 @@ class ButtonView extends StatelessWidget {
|
|||||||
final widthPrefix =
|
final widthPrefix =
|
||||||
this.widthPrefix ?? (heightWrapContent ? width! / 4.7 : _widthBtn / 16);
|
this.widthPrefix ?? (heightWrapContent ? width! / 4.7 : _widthBtn / 16);
|
||||||
|
|
||||||
return Container(
|
return Center(
|
||||||
margin: EdgeInsets.symmetric(vertical: marginVertical ?? 32.0),
|
child: Container(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: marginVertical ?? 24.0),
|
||||||
width: width ?? _widthBtn,
|
width: width ?? _widthBtn,
|
||||||
height: heightWrapContent ? null : height ?? _heightBtn,
|
height: heightWrapContent ? null : height ?? _heightBtn,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
@@ -75,7 +76,7 @@ class ButtonView extends StatelessWidget {
|
|||||||
side: isOutlined
|
side: isOutlined
|
||||||
? BorderSide(
|
? BorderSide(
|
||||||
color: disabled
|
color: disabled
|
||||||
? color.surface
|
? ColorPalette.greyBorder
|
||||||
: isSecondaryColor
|
: isSecondaryColor
|
||||||
? ColorPalette.greyBorder
|
? ColorPalette.greyBorder
|
||||||
: ColorPalette.primary,
|
: ColorPalette.primary,
|
||||||
@@ -129,6 +130,7 @@ class ButtonView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
146
lib/application/component/otp/otp_view.dart
Normal file
146
lib/application/component/otp/otp_view.dart
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
import 'package:cims_apps/application/component/otp/otp_viewmodel.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/route/route.dart';
|
||||||
|
import 'package:cims_apps/core/utils/size_config.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/view/registration_password_view.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:pinput/pinput.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class OtpView extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String? contentTitle, contentSubtitle;
|
||||||
|
const OtpView({
|
||||||
|
Key? key,
|
||||||
|
required this.title,
|
||||||
|
this.contentTitle,
|
||||||
|
this.contentSubtitle,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
Widget _otpContent(BuildContext context, OtpViewModel provider) {
|
||||||
|
return Form(
|
||||||
|
key: provider.formKey,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Pinput(
|
||||||
|
length: 4,
|
||||||
|
controller: provider.ctrlPin,
|
||||||
|
focusNode: provider.focusNode,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Pin must be complete';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
defaultPinTheme: PinTheme(
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
color: ColorPalette.slate800,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
width: SizeConfig.width * .19,
|
||||||
|
height: SizeConfig.height * .08,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: const Color(0xFFE2E8F0)),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
errorPinTheme: PinTheme(
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
color: ColorPalette.slate800,
|
||||||
|
fontSize: 24,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
width: SizeConfig.width * .19,
|
||||||
|
height: SizeConfig.height * .08,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.redAccent),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onCompleted: (pin) => provider.enableButton(),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (provider.ctrlPin.length != 4) {
|
||||||
|
provider.enableButton(isActive: false);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 32.0),
|
||||||
|
width: SizeConfig.width,
|
||||||
|
height: SizeConfig.height * .07,
|
||||||
|
child: ElevatedButton(
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
elevation: 0,
|
||||||
|
backgroundColor: ColorPalette.primary,
|
||||||
|
),
|
||||||
|
onPressed: !provider.buttonIsActive
|
||||||
|
? null
|
||||||
|
: () {
|
||||||
|
if (provider.formKey.currentState!.validate()) {
|
||||||
|
final pin = provider.ctrlPin.text;
|
||||||
|
provider.validateOtp(pin).then((value) {
|
||||||
|
if (value) {
|
||||||
|
routePush(context,
|
||||||
|
page: const RegistrationPasswordView(),
|
||||||
|
routeType: RouteType.pushReplace);
|
||||||
|
} else {
|
||||||
|
provider.ctrlPin.clear();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Verify',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => OtpViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(title),
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child:
|
||||||
|
Consumer<OtpViewModel>(builder: (context, provider, child) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
TextCaption(
|
||||||
|
title: contentTitle ?? '',
|
||||||
|
subtitle: contentSubtitle ?? '',
|
||||||
|
),
|
||||||
|
_otpContent(context, provider),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
provider.ctrlPin.clear();
|
||||||
|
},
|
||||||
|
child: const Text(
|
||||||
|
'Resend Code',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
22
lib/application/component/otp/otp_viewmodel.dart
Normal file
22
lib/application/component/otp/otp_viewmodel.dart
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class OtpViewModel extends ChangeNotifier {
|
||||||
|
var formKey = GlobalKey<FormState>();
|
||||||
|
var focusNode = FocusNode();
|
||||||
|
bool buttonIsActive = false;
|
||||||
|
|
||||||
|
TextEditingController ctrlPin = TextEditingController();
|
||||||
|
|
||||||
|
Future<bool> validateOtp(String pin) async {
|
||||||
|
final pinLength = pin.length;
|
||||||
|
if (pinLength == 4) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void enableButton({bool isActive = true}) {
|
||||||
|
buttonIsActive = isActive;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
176
lib/application/component/select_form/select_form_view.dart
Normal file
176
lib/application/component/select_form/select_form_view.dart
Normal 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,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -3,10 +3,14 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class TextCaption extends StatelessWidget {
|
class TextCaption extends StatelessWidget {
|
||||||
final String title, subtitle;
|
final String title, subtitle;
|
||||||
|
final TextAlign? textAlignSubtitle;
|
||||||
|
final CrossAxisAlignment? crossAxisAlignment;
|
||||||
const TextCaption({
|
const TextCaption({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
this.subtitle = '',
|
this.subtitle = '',
|
||||||
|
this.textAlignSubtitle,
|
||||||
|
this.crossAxisAlignment,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -14,7 +18,7 @@ class TextCaption extends StatelessWidget {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 32.0),
|
padding: const EdgeInsets.only(bottom: 32.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: crossAxisAlignment ?? CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
@@ -30,10 +34,11 @@ class TextCaption extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(top: 8.0),
|
padding: const EdgeInsets.only(top: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
subtitle,
|
subtitle,
|
||||||
|
textAlign: textAlignSubtitle ?? TextAlign.start,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: ColorPalette.slate800,
|
color: ColorPalette.slate500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@@ -14,7 +14,7 @@ class TextFormView extends StatelessWidget {
|
|||||||
final String? hintText, errorText;
|
final String? hintText, errorText;
|
||||||
final TextEditingController? ctrl;
|
final TextEditingController? ctrl;
|
||||||
final Widget? suffixIcon, suffixLable;
|
final Widget? suffixIcon, suffixLable;
|
||||||
final Widget? prefixIcon;
|
final Widget? prefixIcon, prefix;
|
||||||
final TextInputType? keyboardType;
|
final TextInputType? keyboardType;
|
||||||
final FormFieldValidator<String>? validator;
|
final FormFieldValidator<String>? validator;
|
||||||
final bool obscureText;
|
final bool obscureText;
|
||||||
@@ -70,7 +70,8 @@ class TextFormView extends StatelessWidget {
|
|||||||
this.disableColor = false,
|
this.disableColor = false,
|
||||||
this.enableInteractiveSelection = true,
|
this.enableInteractiveSelection = true,
|
||||||
this.focusNode,
|
this.focusNode,
|
||||||
this.isTextAlignCenter = false})
|
this.isTextAlignCenter = false,
|
||||||
|
this.prefix})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -94,12 +95,12 @@ class TextFormView extends StatelessWidget {
|
|||||||
name,
|
name,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: ColorPalette.greyLight,
|
// color: ColorPalette.greyLight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
suffixLable ??
|
suffixLable ??
|
||||||
const Text(
|
const Text(
|
||||||
" * ",
|
"",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
@@ -155,7 +156,7 @@ class TextFormView extends StatelessWidget {
|
|||||||
hintStyle: hintTextStyle ??
|
hintStyle: hintTextStyle ??
|
||||||
const TextStyle(
|
const TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Colors.grey,
|
color: ColorPalette.greyFont,
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
),
|
),
|
||||||
isDense: true,
|
isDense: true,
|
||||||
@@ -167,19 +168,19 @@ class TextFormView extends StatelessWidget {
|
|||||||
disabledBorder: OutlineInputBorder(
|
disabledBorder: OutlineInputBorder(
|
||||||
borderRadius: _borderRadius,
|
borderRadius: _borderRadius,
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: disabledborderColor ?? ColorPalette.greyFont,
|
color: disabledborderColor ?? ColorPalette.greyBorder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
enabledBorder: OutlineInputBorder(
|
enabledBorder: OutlineInputBorder(
|
||||||
borderRadius: _borderRadius,
|
borderRadius: _borderRadius,
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: enabledborderColor ?? ColorPalette.greyBase,
|
color: enabledborderColor ?? ColorPalette.greyBorder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
borderRadius: _borderRadius,
|
borderRadius: _borderRadius,
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: focusedBorderColor ?? ColorPalette.greyBase,
|
color: focusedBorderColor ?? ColorPalette.greyBorder,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
border: OutlineInputBorder(borderRadius: _borderRadius),
|
border: OutlineInputBorder(borderRadius: _borderRadius),
|
||||||
@@ -187,7 +188,8 @@ class TextFormView extends StatelessWidget {
|
|||||||
prefixIcon: prefixIcon,
|
prefixIcon: prefixIcon,
|
||||||
suffixIconConstraints: suffixIconConstraints,
|
suffixIconConstraints: suffixIconConstraints,
|
||||||
prefixIconConstraints: preffixIconConstraints,
|
prefixIconConstraints: preffixIconConstraints,
|
||||||
),
|
prefix: prefix,
|
||||||
|
contentPadding: EdgeInsets.zero),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@@ -73,5 +73,6 @@ class ColorPalette {
|
|||||||
static const Color chathamsBlue = Color(0xFF285BB9);
|
static const Color chathamsBlue = Color(0xFF285BB9);
|
||||||
static const Color background = Color(0xFFDADADA);
|
static const Color background = Color(0xFFDADADA);
|
||||||
static const Color backgroundBlueLight = Color(0xFFEBF3FD);
|
static const Color backgroundBlueLight = Color(0xFFEBF3FD);
|
||||||
|
static const Color slate500 = Color(0xFF64748B);
|
||||||
static const Color slate800 = Color(0xFF1E293B);
|
static const Color slate800 = Color(0xFF1E293B);
|
||||||
}
|
}
|
||||||
|
16
lib/core/utils/string_utils.dart
Normal file
16
lib/core/utils/string_utils.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class StringUtils {
|
||||||
|
static bool emailValidation(String email) {
|
||||||
|
return RegExp(
|
||||||
|
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$')
|
||||||
|
.hasMatch(email);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool phoneValidation(String phone) {
|
||||||
|
return RegExp(r'^(\+62|62|0)8[1-9][0-9]{6,10}$').hasMatch(phone);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool passwordValidation(String password) {
|
||||||
|
return RegExp(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*?[\W_])(?=.{8,})')
|
||||||
|
.hasMatch(password);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,151 @@
|
|||||||
|
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/component/text_form/text_form_view.dart';
|
||||||
|
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||||
|
import 'package:cims_apps/core/route/route.dart';
|
||||||
|
import 'package:cims_apps/core/utils/size_config.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/view/submission_data/submission_parent.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/viewmodel/registration_viewmodel.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class RegistrationPasswordView extends StatelessWidget {
|
||||||
|
const RegistrationPasswordView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => RegistrationViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Sign Up'),
|
||||||
|
),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Consumer<RegistrationViewModel>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return Form(
|
||||||
|
key: provider.formKey,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const TextCaption(
|
||||||
|
title: 'Create your password',
|
||||||
|
subtitle:
|
||||||
|
'The password you create serves as your login',
|
||||||
|
),
|
||||||
|
TextFormView(
|
||||||
|
name: 'Password',
|
||||||
|
hintText: 'Input password',
|
||||||
|
ctrl: provider.passwordCtrl,
|
||||||
|
obscureText: !provider.showPassword,
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Password must filled';
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
suffixIcon: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
provider.toggleVisibility();
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
provider.showPassword
|
||||||
|
? Icons.visibility_outlined
|
||||||
|
: Icons.visibility_off_outlined,
|
||||||
|
color: ColorPalette.greyDarker,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 32.0,
|
||||||
|
),
|
||||||
|
TextFormView(
|
||||||
|
name: 'Confirm Password',
|
||||||
|
hintText: 'Input password',
|
||||||
|
ctrl: provider.confirmPasswordCtrl,
|
||||||
|
obscureText: !provider.showPasswordConfirm,
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Password must filled';
|
||||||
|
} else if (value != provider.passwordCtrl.text) {
|
||||||
|
return 'Password must be same';
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
suffixIcon: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
provider.toggleVisibilityConfirm();
|
||||||
|
},
|
||||||
|
child: Icon(
|
||||||
|
provider.showPasswordConfirm
|
||||||
|
? Icons.visibility_outlined
|
||||||
|
: Icons.visibility_off_outlined,
|
||||||
|
color: ColorPalette.greyDarker,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ButtonView(
|
||||||
|
name: 'Confirm',
|
||||||
|
onPressed: () {
|
||||||
|
if (provider.formKey.currentState!.validate()) {
|
||||||
|
routePush(context, page: const DialogSuccess());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DialogSuccess extends StatelessWidget {
|
||||||
|
const DialogSuccess({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
padding: const EdgeInsets.all(24.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
ImageView(
|
||||||
|
image: PathAssets.imgSuccessSignup,
|
||||||
|
width: SizeConfig.width * .8,
|
||||||
|
),
|
||||||
|
const TextCaption(
|
||||||
|
title: 'Success',
|
||||||
|
subtitle:
|
||||||
|
'Congratulations, your account creation was successful!',
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
textAlignSubtitle: TextAlign.center,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: SizeConfig.height * .2,
|
||||||
|
),
|
||||||
|
ButtonView(
|
||||||
|
name: 'Next',
|
||||||
|
marginVertical: 8.0,
|
||||||
|
onPressed: () {
|
||||||
|
routePush(context,
|
||||||
|
page: const SubmissionParent(),
|
||||||
|
routeType: RouteType.pushReplace);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,11 +1,16 @@
|
|||||||
|
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/button/button_view.dart';
|
||||||
|
import 'package:cims_apps/application/component/image/image_view.dart';
|
||||||
|
import 'package:cims_apps/application/component/otp/otp_view.dart';
|
||||||
import 'package:cims_apps/application/component/text_caption/text_caption.dart';
|
import 'package:cims_apps/application/component/text_caption/text_caption.dart';
|
||||||
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
|
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
|
||||||
import 'package:cims_apps/core/route/route.dart';
|
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||||
import 'package:cims_apps/features/auth/registration/view/initial_registration_step.dart';
|
import 'package:cims_apps/core/utils/size_config.dart';
|
||||||
import 'package:cims_apps/features/bottom_navigation_view.dart';
|
import 'package:cims_apps/features/auth/registration/viewmodel/registration_viewmodel.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class RegistrationView extends StatelessWidget {
|
class RegistrationView extends StatelessWidget {
|
||||||
static const routName = '/RegistrationView';
|
static const routName = '/RegistrationView';
|
||||||
@@ -13,12 +18,43 @@ class RegistrationView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
showOtpWidget() {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
showModalBottomSheet(
|
||||||
|
context: context,
|
||||||
|
isScrollControlled: true,
|
||||||
|
enableDrag: false,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: MediaQueryData.fromView(
|
||||||
|
WidgetsBinding.instance.window,
|
||||||
|
).padding.top,
|
||||||
|
),
|
||||||
|
child: const OtpView(
|
||||||
|
title: 'Sign Up',
|
||||||
|
contentTitle: 'Check your SMS',
|
||||||
|
contentSubtitle:
|
||||||
|
'Enter 4 digit code We’ve sent to verify your phone number',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => RegistrationViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Sign Up'),
|
title: const Text('Sign Up'),
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: const EdgeInsets.all(24.0),
|
padding: const EdgeInsets.all(24.0),
|
||||||
|
child: Consumer<RegistrationViewModel>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return Form(
|
||||||
|
key: provider.formKeyPhone,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
@@ -26,11 +62,56 @@ class RegistrationView extends StatelessWidget {
|
|||||||
title: 'Enter your phone number',
|
title: 'Enter your phone number',
|
||||||
subtitle: 'Input your registered phone number',
|
subtitle: 'Input your registered phone number',
|
||||||
),
|
),
|
||||||
TextFormView(name: 'Phone Number'),
|
TextFormView(
|
||||||
|
name: 'Phone Number',
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
inputFormatters: [
|
||||||
|
FilteringTextInputFormatter.deny(RegExp(r'^0'))
|
||||||
|
],
|
||||||
|
prefixIcon: Container(
|
||||||
|
width: SizeConfig.width * .23,
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
|
margin: const EdgeInsets.only(right: 16),
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
color: ColorPalette.grey,
|
||||||
|
borderRadius: BorderRadius.only(
|
||||||
|
topLeft: Radius.circular(8),
|
||||||
|
bottomLeft: Radius.circular(8),
|
||||||
|
)),
|
||||||
|
child: const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
ImageView(
|
||||||
|
image: PathAssets.iconFlag,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'+62',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: ColorPalette.slate800,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
ctrl: provider.phoneNumberCtrl,
|
||||||
|
validator: (value) {
|
||||||
|
if (value!.isEmpty) {
|
||||||
|
return 'Phone number must be filled';
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
ButtonView(
|
ButtonView(
|
||||||
name: 'Next',
|
name: 'Next',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
routePush(context, page: const InitialRegistrationStep());
|
if (provider.formKeyPhone.currentState!.validate()) {
|
||||||
|
showOtpWidget();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
@@ -42,14 +123,11 @@ class RegistrationView extends StatelessWidget {
|
|||||||
text: 'Already have an account? ',
|
text: 'Already have an account? ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
decoration: TextDecoration.underline,
|
decoration: TextDecoration.none,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
recognizer: TapGestureRecognizer()
|
recognizer: TapGestureRecognizer()..onTap = () {},
|
||||||
..onTap = () {
|
|
||||||
print('object');
|
|
||||||
},
|
|
||||||
text: ' Sign In',
|
text: ' Sign In',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
@@ -60,7 +138,10 @@ class RegistrationView extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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: () {},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,9 +1,14 @@
|
|||||||
import 'package:cims_apps/application/component/button/button_view.dart';
|
import 'package:cims_apps/application/component/button/button_view.dart';
|
||||||
import 'package:cims_apps/application/theme/color_palette.dart';
|
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||||
|
import 'package:cims_apps/core/route/route.dart';
|
||||||
import 'package:cims_apps/core/utils/size_config.dart';
|
import 'package:cims_apps/core/utils/size_config.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/view/submission_data/initial_take_photo.dart';
|
||||||
import 'package:cims_apps/features/auth/registration/view/submission_data/submit_email.dart';
|
import 'package:cims_apps/features/auth/registration/view/submission_data/submit_email.dart';
|
||||||
import 'package:cims_apps/features/auth/registration/view/submission_data/submit_personal_data.dart';
|
import 'package:cims_apps/features/auth/registration/view/submission_data/submit_personal_data.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/viewmodel/submission_data_viewmodel.dart';
|
||||||
|
import 'package:cims_apps/features/bottom_navigation_view.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class SubmissionParent extends StatefulWidget {
|
class SubmissionParent extends StatefulWidget {
|
||||||
static const routeName = '/SubmissionParent';
|
static const routeName = '/SubmissionParent';
|
||||||
@@ -14,20 +19,8 @@ class SubmissionParent extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SubmissionParentState extends State<SubmissionParent> {
|
class _SubmissionParentState extends State<SubmissionParent> {
|
||||||
int _currentStep = 1;
|
|
||||||
final int _stepAmount = 9;
|
|
||||||
Widget _stepItem({bool isCurrentStep = false, bool isDone = false}) {
|
Widget _stepItem({bool isCurrentStep = false, bool isDone = false}) {
|
||||||
return GestureDetector(
|
return Container(
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
if (_currentStep > 1) {
|
|
||||||
_currentStep--;
|
|
||||||
} else if (_currentStep == 1) {
|
|
||||||
_currentStep++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: const EdgeInsets.only(right: 4.0, left: 4.0),
|
margin: const EdgeInsets.only(right: 4.0, left: 4.0),
|
||||||
height: 6,
|
height: 6,
|
||||||
width: SizeConfig.width * .08,
|
width: SizeConfig.width * .08,
|
||||||
@@ -37,7 +30,6 @@ class _SubmissionParentState extends State<SubmissionParent> {
|
|||||||
: ColorPalette.greyBorderNeutrals,
|
: ColorPalette.greyBorderNeutrals,
|
||||||
borderRadius: BorderRadius.circular(50),
|
borderRadius: BorderRadius.circular(50),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,9 +40,7 @@ class _SubmissionParentState extends State<SubmissionParent> {
|
|||||||
case 2:
|
case 2:
|
||||||
return const SubmitEmail();
|
return const SubmitEmail();
|
||||||
case 3:
|
case 3:
|
||||||
return Container(
|
return const InitialTakePhoto();
|
||||||
child: Text("Step 3"),
|
|
||||||
);
|
|
||||||
case 4:
|
case 4:
|
||||||
return Container(
|
return Container(
|
||||||
child: Text("Step 4"),
|
child: Text("Step 4"),
|
||||||
@@ -80,14 +70,27 @@ class _SubmissionParentState extends State<SubmissionParent> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => SubmissionDataViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
await routePush(context,
|
||||||
|
page: const BottomNavigationView(),
|
||||||
|
routeType: RouteType.pushReplace);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('Registration'),
|
title: const Text('Registration'),
|
||||||
),
|
),
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Consumer<SubmissionDataViewModel>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
@@ -95,33 +98,40 @@ class _SubmissionParentState extends State<SubmissionParent> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
_stepAmount,
|
provider.stepAmount,
|
||||||
(index) => _stepItem(
|
(index) => _stepItem(
|
||||||
isCurrentStep: _currentStep == index + 1,
|
isCurrentStep:
|
||||||
|
provider.currentStep == index + 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Container(
|
Expanded(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
child: Container(
|
||||||
child: _content(_currentStep),
|
padding:
|
||||||
)
|
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||||
],
|
child: _content(provider.currentStep),
|
||||||
),
|
),
|
||||||
Align(
|
),
|
||||||
|
provider.currentStep == 3
|
||||||
|
? const SizedBox()
|
||||||
|
: Align(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
child: ButtonView(
|
child: ButtonView(
|
||||||
name: 'Next',
|
name: 'Next',
|
||||||
marginVertical: 16.0,
|
marginVertical: 16.0,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
provider.nextSubmission(context);
|
||||||
_currentStep++;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +1,81 @@
|
|||||||
|
import 'package:cims_apps/application/assets/path_assets.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/component/text_caption/text_caption.dart';
|
||||||
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
|
import 'package:cims_apps/application/component/text_form/text_form_view.dart';
|
||||||
|
import 'package:cims_apps/features/auth/registration/viewmodel/submission_data_viewmodel.dart';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class SubmitEmail extends StatelessWidget {
|
class SubmitEmail extends StatelessWidget {
|
||||||
const SubmitEmail({Key? key}) : super(key: key);
|
const SubmitEmail({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
Widget _emailVerify() {
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
const TextCaption(title: 'Enter your e-mail'),
|
const ImageView(image: PathAssets.imgEmail),
|
||||||
TextFormView(
|
Align(
|
||||||
name: 'E-mail Address',
|
alignment: Alignment.center,
|
||||||
hintText: 'Input e-mail address',
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(children: [
|
||||||
|
const TextSpan(
|
||||||
|
text:
|
||||||
|
'We have sent a verification link to your e-mail. \nPlease check your email for ',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
recognizer: TapGestureRecognizer()
|
||||||
|
..onTap = () {
|
||||||
|
print('object');
|
||||||
|
},
|
||||||
|
text: 'verification',
|
||||||
|
style: const TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const TextSpan(
|
||||||
|
text: ' to \ncontinue registration.',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => SubmissionDataViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
|
return Consumer<SubmissionDataViewModel>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
!provider.isEmailVerify
|
||||||
|
? const TextCaption(title: 'Enter your e-mail')
|
||||||
|
: const TextCaption(title: 'Check your e-mail '),
|
||||||
|
!provider.isEmailVerify
|
||||||
|
? TextFormView(
|
||||||
|
name: 'E-mail Address',
|
||||||
|
hintText: 'Input e-mail address',
|
||||||
|
onTap: () {
|
||||||
|
provider.submitEmail();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
: _emailVerify(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,56 @@
|
|||||||
|
import 'package:cims_apps/application/component/select_form/select_form_view.dart';
|
||||||
import 'package:cims_apps/application/component/text_caption/text_caption.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/features/auth/registration/viewmodel/submission_data_viewmodel.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class SubmitPersonalData extends StatelessWidget {
|
class SubmitPersonalData extends StatelessWidget {
|
||||||
const SubmitPersonalData({Key? key}) : super(key: key);
|
const SubmitPersonalData({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
List<ItemSelectForm> listForm = [
|
||||||
|
ItemSelectForm('key1', 'text'),
|
||||||
|
ItemSelectForm('key2', 'text'),
|
||||||
|
ItemSelectForm('key3', 'text'),
|
||||||
|
ItemSelectForm('key4', 'text'),
|
||||||
|
ItemSelectForm('key5', 'text'),
|
||||||
|
];
|
||||||
|
return ChangeNotifierProvider(
|
||||||
|
create: (context) => SubmissionDataViewModel(),
|
||||||
|
builder: (context, child) {
|
||||||
|
return Consumer<SubmissionDataViewModel>(
|
||||||
|
builder: (context, provider, child) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
TextCaption(title: 'Your personal details'),
|
const TextCaption(title: 'Your personal details'),
|
||||||
|
SelectFormView(
|
||||||
|
name: 'Occupation',
|
||||||
|
hintText: 'Select occupation ',
|
||||||
|
bottomSheetTitle: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
const Text('Occupation'),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.clear,
|
||||||
|
size: 20,
|
||||||
|
color: ColorPalette.greyBase,
|
||||||
|
)),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
listItem: listForm,
|
||||||
|
onSelect: (value) {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class RegistrationViewModel extends ChangeNotifier {
|
||||||
|
TextEditingController passwordCtrl = TextEditingController();
|
||||||
|
TextEditingController confirmPasswordCtrl = TextEditingController();
|
||||||
|
TextEditingController phoneNumberCtrl = TextEditingController();
|
||||||
|
var formKey = GlobalKey<FormState>();
|
||||||
|
var formKeyPhone = GlobalKey<FormState>();
|
||||||
|
bool showPassword = false;
|
||||||
|
bool showPasswordConfirm = false;
|
||||||
|
|
||||||
|
void toggleVisibility() {
|
||||||
|
showPassword = !showPassword;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleVisibilityConfirm() {
|
||||||
|
showPasswordConfirm = !showPasswordConfirm;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
45
pubspec.lock
45
pubspec.lock
@@ -163,6 +163,11 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
http:
|
http:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -227,6 +232,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.10.0"
|
||||||
|
nested:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: nested
|
||||||
|
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
octo_image:
|
octo_image:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -315,6 +328,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.2"
|
version: "6.0.2"
|
||||||
|
pinput:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: pinput
|
||||||
|
sha256: "543da5bfdefd9e06914a12100f8c9156f84cef3efc14bca507c49e966c5b813b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.3.0"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -339,6 +360,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.7.4"
|
version: "3.7.4"
|
||||||
|
provider:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: provider
|
||||||
|
sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.1.1"
|
||||||
remove_emoji_input_formatter:
|
remove_emoji_input_formatter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -360,6 +389,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.99"
|
version: "0.0.99"
|
||||||
|
smart_auth:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: smart_auth
|
||||||
|
sha256: a25229b38c02f733d0a4e98d941b42bed91a976cb589e934895e60ccfa674cf6
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.1"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -448,6 +485,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.2"
|
version: "1.3.2"
|
||||||
|
universal_platform:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: universal_platform
|
||||||
|
sha256: d315be0f6641898b280ffa34e2ddb14f3d12b1a37882557869646e0cc363d0cc
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0+1"
|
||||||
uuid:
|
uuid:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@@ -39,6 +39,9 @@ dependencies:
|
|||||||
flutter_svg: ^1.1.6
|
flutter_svg: ^1.1.6
|
||||||
cached_network_image: ^3.2.3
|
cached_network_image: ^3.2.3
|
||||||
remove_emoji_input_formatter: ^0.0.1+1
|
remove_emoji_input_formatter: ^0.0.1+1
|
||||||
|
provider: ^6.1.1
|
||||||
|
pinput: ^2.2.21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user