fix: continued product view
This commit is contained in:
@@ -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,10 +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/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_form/text_form_view.dart';
|
||||
import 'package:cims_apps/core/route/route.dart';
|
||||
import 'package:cims_apps/features/auth/registration/view/initial_registration_step.dart';
|
||||
import 'package:cims_apps/application/theme/color_palette.dart';
|
||||
import 'package:cims_apps/core/utils/size_config.dart';
|
||||
import 'package:cims_apps/features/auth/registration/viewmodel/registration_viewmodel.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class RegistrationView extends StatelessWidget {
|
||||
static const routName = '/RegistrationView';
|
||||
@@ -12,54 +18,130 @@ class RegistrationView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sign Up'),
|
||||
),
|
||||
body: Container(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextCaption(
|
||||
title: 'Enter your phone number',
|
||||
subtitle: 'Input your registered phone number',
|
||||
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,
|
||||
),
|
||||
TextFormView(name: 'Phone Number'),
|
||||
ButtonView(
|
||||
name: 'Next',
|
||||
onPressed: () {
|
||||
routePush(context, page: const InitialRegistrationStep());
|
||||
},
|
||||
child: const OtpView(
|
||||
title: 'Sign Up',
|
||||
contentTitle: 'Check your SMS',
|
||||
contentSubtitle:
|
||||
'Enter 4 digit code We’ve sent to verify your phone number',
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(children: [
|
||||
const TextSpan(
|
||||
text: 'Already have an account? ',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => RegistrationViewModel(),
|
||||
builder: (context, child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Sign Up'),
|
||||
),
|
||||
body: Container(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Consumer<RegistrationViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return Form(
|
||||
key: provider.formKeyPhone,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const TextCaption(
|
||||
title: 'Enter your phone number',
|
||||
subtitle: 'Input your registered 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(
|
||||
name: 'Next',
|
||||
onPressed: () {
|
||||
if (provider.formKeyPhone.currentState!.validate()) {
|
||||
showOtpWidget();
|
||||
}
|
||||
},
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: RichText(
|
||||
textAlign: TextAlign.center,
|
||||
text: TextSpan(children: [
|
||||
const TextSpan(
|
||||
text: 'Already have an account? ',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()..onTap = () {},
|
||||
text: ' Sign In',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
print('object');
|
||||
},
|
||||
text: ' Sign In',
|
||||
style: const TextStyle(
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import 'package:cims_apps/application/component/button/button_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/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_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:provider/provider.dart';
|
||||
|
||||
@@ -71,53 +73,63 @@ class _SubmissionParentState extends State<SubmissionParent> {
|
||||
return ChangeNotifierProvider(
|
||||
create: (context) => SubmissionDataViewModel(),
|
||||
builder: (context, child) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Registration'),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Consumer<SubmissionDataViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: List.generate(
|
||||
provider.stepAmount,
|
||||
(index) => _stepItem(
|
||||
isCurrentStep: provider.currentStep == index + 1,
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
await routePush(context,
|
||||
page: const BottomNavigationView(),
|
||||
routeType: RouteType.pushReplace);
|
||||
return false;
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Registration'),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Consumer<SubmissionDataViewModel>(
|
||||
builder: (context, provider, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16.0, vertical: 16.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: List.generate(
|
||||
provider.stepAmount,
|
||||
(index) => _stepItem(
|
||||
isCurrentStep:
|
||||
provider.currentStep == index + 1,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: _content(provider.currentStep),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: _content(provider.currentStep),
|
||||
),
|
||||
),
|
||||
),
|
||||
provider.currentStep == 3
|
||||
? const SizedBox()
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ButtonView(
|
||||
name: 'Next',
|
||||
marginVertical: 16.0,
|
||||
onPressed: () {
|
||||
provider.nextSubmission(context);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
provider.currentStep == 3
|
||||
? const SizedBox()
|
||||
: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ButtonView(
|
||||
name: 'Next',
|
||||
marginVertical: 16.0,
|
||||
onPressed: () {
|
||||
provider.nextSubmission(context);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user