You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.7 KiB

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:youtribe_lib/store/user.dart';
class AccountForm extends StatefulWidget {
@override
AccountFormState createState() => AccountFormState();
}
class AccountFormState extends State<AccountForm> {
final userController = Get.put(UserController());
final _formKey = GlobalKey<FormState>();
String email;
String firstName;
String lastName;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('my-account'.tr),
),
body: Center(
child: FractionallySizedBox(
widthFactor: 0.5,
child: Obx(
() => (Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text('my-account'.tr),
TextFormField(
decoration: InputDecoration(labelText: 'first-name'.tr),
initialValue: userController.user['first_name'],
onChanged: (value) => firstName = value,
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () => userController.patch(
{"id": 2, "title": "bbb"},
collection: "agency"),
// userController.patch({'first_name': firstName}),
child: Text('save'.tr))
],
),
)),
),
),
));
}
}