You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/pages/login/register-info.dart

156 lines
6.3 KiB
Dart

4 years ago
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/config/size_config.dart';
import 'package:diplomaticquarterapp/models/Authentication/register_info_response.dart';
import 'package:diplomaticquarterapp/pages/login/login-type.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/card/rounded_container.dart';
import 'package:diplomaticquarterapp/widgets/input/text_field.dart';
import 'package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class RegisterInfo extends StatefulWidget {
@override
_RegisterInfo createState() => _RegisterInfo();
}
class _RegisterInfo extends State<RegisterInfo> {
final authService = new AuthProvider();
final sharedPref = new AppSharedPreferences();
RegisterInfoResponse registerInfo;
bool isLoading;
4 years ago
int page = 1;
4 years ago
@override
void initState() {
getRegisterInfo();
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).register,
isShowAppBar: true,
isShowDecPage: false,
4 years ago
body: SingleChildScrollView(
child: Container(
padding: EdgeInsets.only(top: 10, left: 20, right: 20, bottom: 30),
height: SizeConfig.realScreenHeight * .9,
width: SizeConfig.realScreenWidth,
child: Column(children: <Widget>[
Expanded(
flex: 1,
child: AppText(
TranslationBase.of(context).patientInfo,
fontSize: SizeConfig.textMultiplier * 3,
textAlign: TextAlign.left,
)),
4 years ago
registerInfo != null && page == 1
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
AppText('National ID'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.idNumber,
prefixIcon: Icon(Icons.chrome_reader_mode,
color: Colors.red),
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText('Name'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.firstNameEn +
' ' +
registerInfo.lastNameEn,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText('Gender'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.maritalStatusCode == 'U'
? 'Unknown'
: registerInfo.maritalStatusCode == 'M'
? 'Male'
: 'Female',
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText('Nationality'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.nationalityCode,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
AppText('Date of Birth'),
Container(
margin: EdgeInsets.only(bottom: 10),
child: TextFields(
hintText: registerInfo.dateOfBirth,
padding: EdgeInsets.only(
top: 20, bottom: 20, left: 10, right: 10),
readOnly: true,
)),
],
4 years ago
)
4 years ago
: registerInfo != null && page == 2
? Column(
children: <Widget>[],
)
: SizedBox(),
4 years ago
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: DefaultButton(
4 years ago
TranslationBase.of(context).next,
() => {nextPage()},
4 years ago
textColor: Colors.white,
))
],
),
],
))
]),
)));
}
4 years ago
nextPage() {
setState(() {
page++;
});
}
4 years ago
registerNow() {}
getRegisterInfo() async {
registerInfo =
RegisterInfoResponse.fromJson(await sharedPref.getObject(NHIC_DATA));
print(await sharedPref.getObject(NHIC_DATA));
}
}