class ProfileScreenState extends State<ProfileScreen> {
TextEditingController mobile = TextEditingController();
void initState() {
GetDetails();
getMobile();
}
@override
Widget build(BuildContext context) {
// TODO: implement build
pr = new ProgressDialog(context, showLogs: true);
pr.style(message: 'Please wait...');
return Scaffold(
appBar: AppBar(
title: Text("Profile", style: TextStyle(color: Colors.black)),
backgroundColor: Colors.orange,
),
body: SingleChildScrollView(
child: Stack(
children: [
Column(
children: [
Container(
child: Image.asset('assets/images/gym.png',
height: 150,
width: double.infinity,
fit: BoxFit.fitWidth),
),
SizedBox(
height: 50,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
decoration: InputDecoration(
hintText: 'User',
prefixIcon: Icon(Icons.perm_identity),
),
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: mobile,
decoration: InputDecoration(
prefixIcon: Icon(Icons.mobile_screen_share),
),
),
),
),
],
),
);
}
从Sharedpreference获取数据
Future getMobile()异步{
Future notificatinstatus = SharedPrefrence().getUserMobile(); notificatinstatus.then((data) async { var mobile_no=data; mobile_no.text=mobile; return mobile; }); }
我有一个共享的数据,其中包含客户的移动电话号码,在我的个人资料中,当我打开个人资料页面时,需要从文本首选项数据中获取数据,当我加载数据时,需要在文本字段中填写...