2022-12-05 08:06:45 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import 'package:fluttericon/font_awesome_icons.dart';
|
2022-12-20 06:26:37 +00:00
|
|
|
import 'package:form_builder_validators/form_builder_validators.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:unit2/theme-data.dart/text-styles.dart';
|
|
|
|
import 'package:unit2/utils/screen_info.dart';
|
|
|
|
import '../../theme-data.dart/btn-style.dart';
|
|
|
|
import '../../theme-data.dart/colors.dart';
|
|
|
|
import '../../theme-data.dart/form-style.dart';
|
|
|
|
import '../../utils/global.dart';
|
|
|
|
import '../../utils/text_container.dart';
|
|
|
|
import '../../utils/validators.dart';
|
|
|
|
import '../../widgets/wave.dart';
|
|
|
|
|
|
|
|
class AddMobile extends StatelessWidget {
|
|
|
|
AddMobile({super.key});
|
|
|
|
final _formKey = GlobalKey<FormBuilderState>();
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return WillPopScope(
|
|
|
|
onWillPop: () async {
|
|
|
|
return true;
|
|
|
|
},
|
2022-12-20 06:26:37 +00:00
|
|
|
child: SafeArea(
|
|
|
|
child: Scaffold(
|
|
|
|
appBar: AppBar(
|
2023-01-17 07:52:31 +00:00
|
|
|
title: const Text("Add contact info"),
|
|
|
|
centerTitle: true,
|
2022-12-20 06:26:37 +00:00
|
|
|
backgroundColor: primary,
|
|
|
|
elevation: 0,
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
2022-12-20 06:26:37 +00:00
|
|
|
resizeToAvoidBottomInset: true,
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: SizedBox(
|
|
|
|
height: screenHeight * .90,
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
Wave(height: blockSizeVertical * 8),
|
|
|
|
Positioned(
|
|
|
|
bottom: 0,
|
|
|
|
right: 0,
|
|
|
|
child: WaveReverse(height: blockSizeVertical * 8)),
|
|
|
|
Container(
|
|
|
|
height: screenHeight,
|
|
|
|
padding: isMobile()
|
|
|
|
? const EdgeInsets.symmetric(horizontal: 24)
|
|
|
|
: const EdgeInsets.symmetric(horizontal: 60),
|
|
|
|
width: double.infinity,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
height: isMobile()
|
|
|
|
? screenHeight * .12
|
|
|
|
: screenHeight * .20),
|
|
|
|
SvgPicture.asset(
|
|
|
|
'assets/svgs/add_mobile.svg',
|
2022-12-05 08:06:45 +00:00
|
|
|
height: isMobile()
|
2022-12-20 06:26:37 +00:00
|
|
|
? blockSizeVertical * 22
|
|
|
|
: blockSizeVertical * 30,
|
|
|
|
allowDrawingOutsideViewBox: true,
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
Text(addMobile, style: titleTextStyle()),
|
|
|
|
const SizedBox(
|
|
|
|
height: 8,
|
|
|
|
),
|
|
|
|
Text(addMobileCaption,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: Theme.of(context).textTheme.caption),
|
|
|
|
const SizedBox(
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
FormBuilder(
|
|
|
|
key: _formKey,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
// Mobile number 1
|
|
|
|
FormBuilderTextField(
|
|
|
|
name: 'mobile1',
|
|
|
|
validator: mobileNumberValidator,
|
|
|
|
maxLength: 11,
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(mobile1, "+63")),
|
|
|
|
const SizedBox(
|
|
|
|
height: 12,
|
|
|
|
),
|
|
|
|
FormBuilderTextField(
|
|
|
|
name: 'mobile2',
|
|
|
|
maxLength: 11,
|
|
|
|
decoration:
|
|
|
|
normalTextFieldStyle(mobile2, "+63")),
|
2022-12-05 08:06:45 +00:00
|
|
|
|
2022-12-20 06:26:37 +00:00
|
|
|
SizedBox(
|
|
|
|
height: isMobile()
|
|
|
|
? blockSizeVertical * 3
|
|
|
|
: blockSizeHorizontal * 5),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
height: screenHeight * .06,
|
|
|
|
child: ElevatedButton(
|
|
|
|
style: secondaryBtnStyle(second,
|
|
|
|
Colors.transparent, Colors.white54),
|
|
|
|
child: const Text(
|
|
|
|
submit,
|
|
|
|
style: TextStyle(color: Colors.white),
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
if (_formKey.currentState!
|
|
|
|
.saveAndValidate()) {
|
|
|
|
context.go(context
|
|
|
|
.namedLocation('request-sos'));
|
|
|
|
}
|
2022-12-12 08:44:26 +00:00
|
|
|
|
2022-12-20 06:26:37 +00:00
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
2022-12-20 06:26:37 +00:00
|
|
|
],
|
|
|
|
))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|