200 lines
7.0 KiB
200 lines
7.0 KiB
3 years ago
|
import 'package:dio/dio.dart';
|
||
|
import 'package:flutter/material.dart';
|
||
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||
|
import 'package:huixiang/generated/l10n.dart';
|
||
|
import 'package:huixiang/retrofit/data/address.dart';
|
||
|
import 'package:huixiang/retrofit/data/base_data.dart';
|
||
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
||
|
import 'package:huixiang/utils/font_weight.dart';
|
||
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||
|
|
||
|
class BindingAssistantCard extends StatefulWidget {
|
||
|
@override
|
||
|
State<StatefulWidget> createState() {
|
||
|
return _BindingAssistantCard();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class _BindingAssistantCard extends State<BindingAssistantCard> {
|
||
|
TextEditingController nameController = TextEditingController();
|
||
|
TextEditingController mobileController = TextEditingController();
|
||
|
TextEditingController addressController = TextEditingController();
|
||
|
TextEditingController houseNumberController = TextEditingController();
|
||
|
|
||
|
ApiService apiService;
|
||
|
|
||
|
@override
|
||
|
void initState() {
|
||
|
super.initState();
|
||
|
|
||
|
SharedPreferences.getInstance().then((value) => {
|
||
|
apiService = ApiService(Dio(),
|
||
|
context: context, token: value.getString('token')),
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: MyAppBar(
|
||
|
title: S.of(context).bangdingfuka,
|
||
|
titleColor: Colors.black,
|
||
|
leadingColor: Colors.black,
|
||
|
background: Colors.transparent,
|
||
|
),
|
||
|
body: Stack(
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: Column(
|
||
|
children: [
|
||
|
Container(
|
||
|
margin: EdgeInsets.only(bottom: 26.h),
|
||
|
padding: EdgeInsets.only(top: 16.h, bottom: 16.h),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
children: [
|
||
|
Padding(
|
||
|
padding: EdgeInsets.only(left: 16, right: 16),
|
||
|
child: Text(
|
||
|
"进行副卡绑定",
|
||
|
style: TextStyle(
|
||
|
color: Colors.black,
|
||
|
fontWeight: MyFontWeight.medium,
|
||
|
fontSize: 21.sp,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
Padding(
|
||
|
padding: EdgeInsets.only(
|
||
|
left: 16, right: 16, top: 8, bottom: 32),
|
||
|
child: Text(
|
||
|
"主卡最多只能绑定5位副卡,只能解绑3次",
|
||
|
style: TextStyle(
|
||
|
color: Color(0xFFFF7A1A),
|
||
|
fontWeight: MyFontWeight.regular,
|
||
|
fontSize: 12.sp,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
editItem(
|
||
|
S.of(context).fukashoujihao,
|
||
|
"",
|
||
|
S.of(context).qingshurushoujihao,
|
||
|
mobileController,
|
||
|
false),
|
||
|
Container(
|
||
|
margin:
|
||
|
EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||
|
width: double.infinity,
|
||
|
height: 1,
|
||
|
color: Color(0xFFF4F4F4),
|
||
|
),
|
||
|
Row(
|
||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
children: [
|
||
|
Expanded(
|
||
|
child: InkWell(
|
||
|
onTap: () {},
|
||
|
child: editItem(
|
||
|
"验证码",
|
||
|
"",
|
||
|
S.of(context).qingshuruyanzhengma,
|
||
|
addressController,
|
||
|
false),
|
||
|
)),
|
||
|
Padding(
|
||
|
padding: EdgeInsets.only(right: 16, top: 10),
|
||
|
child: GestureDetector(
|
||
|
onTap: () {},
|
||
|
child: Text(
|
||
|
"发送验证",
|
||
|
style: TextStyle(
|
||
|
fontSize: 14.sp,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Color(0xFF32A060),
|
||
|
),
|
||
|
),
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
Container(
|
||
|
margin:
|
||
|
EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||
|
width: double.infinity,
|
||
|
height: 1,
|
||
|
color: Color(0xFFF4F4F4),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
Align(
|
||
|
alignment: Alignment.bottomCenter,
|
||
|
child: InkWell(
|
||
|
onTap: () {
|
||
|
|
||
|
},
|
||
|
child: Container(
|
||
|
color: Color(0xFF32A060),
|
||
|
width: MediaQuery.of(context).size.width,
|
||
|
padding: EdgeInsets.all(16),
|
||
|
height: 54,
|
||
|
alignment: Alignment.center,
|
||
|
child: Text(
|
||
|
S.of(context).querenbangding,
|
||
|
style: TextStyle(
|
||
|
fontWeight: FontWeight.bold,
|
||
|
fontSize: 16.sp,
|
||
|
color: Colors.white,
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
)),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
Widget editItem(start, text, hide, controller, isClick) {
|
||
|
return Container(
|
||
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 5),
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||
|
children: [
|
||
|
Text(
|
||
|
start,
|
||
|
style: TextStyle(
|
||
|
fontSize: 16.sp,
|
||
|
fontWeight: FontWeight.bold,
|
||
|
color: Color(0xFF353535),
|
||
|
),
|
||
|
),
|
||
|
TextField(
|
||
|
controller: controller,
|
||
|
enabled: start != "地址",
|
||
|
keyboardType:
|
||
|
start == "电话" ? TextInputType.phone : TextInputType.text,
|
||
|
decoration: InputDecoration(
|
||
|
border: InputBorder.none,
|
||
|
hintText: hide,
|
||
|
hintStyle: TextStyle(
|
||
|
color: Color(0xFFA29E9E),
|
||
|
fontSize: 14.sp,
|
||
|
),
|
||
|
contentPadding: EdgeInsets.all(0),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|