UI form tweaks
This commit is contained in:
parent
ba4e7f2a94
commit
49e78793f9
|
@ -18,10 +18,8 @@ Future<void> showAbout(BuildContext context) async {
|
|||
String? versionString;
|
||||
final id = commitId.substring(0, 8);
|
||||
versionString = "${s.version}: $packageVersion/$id";
|
||||
if (WarpApi.hasCuda())
|
||||
versionString += "-CUDA";
|
||||
if (WarpApi.hasMetal())
|
||||
versionString += "-METAL";
|
||||
if (WarpApi.hasCuda()) versionString += "-CUDA";
|
||||
if (WarpApi.hasMetal()) versionString += "-METAL";
|
||||
final mq = MediaQuery.of(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
|
@ -29,15 +27,19 @@ Future<void> showAbout(BuildContext context) async {
|
|||
builder: (context) => AlertDialog(
|
||||
title: Text('${S.of(context).about} $APP_NAME'),
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
content: Container(width: mq.size.width, height: mq.size.height,
|
||||
child: SingleChildScrollView(child: Column(
|
||||
children: [
|
||||
MarkdownBody(data: content),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 8)),
|
||||
content: Container(
|
||||
width: mq.size.width,
|
||||
height: mq.size.height,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
MarkdownBody(data: content),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 8)),
|
||||
if (versionString != null)
|
||||
TextButton(child: Text(versionString), onPressed: _onVersion),
|
||||
],
|
||||
))),
|
||||
TextButton(
|
||||
child: Text(versionString), onPressed: _onVersion),
|
||||
],
|
||||
))),
|
||||
actions: [
|
||||
ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
@ -125,7 +126,7 @@ class ContactForm extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ContactState extends State<ContactForm> {
|
||||
final formKey = GlobalKey<FormState>();
|
||||
final formKey = GlobalKey<FormBuilderState>();
|
||||
final nameController = TextEditingController();
|
||||
var address = "";
|
||||
|
||||
|
@ -138,20 +139,28 @@ class ContactState extends State<ContactForm> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Form(
|
||||
final mq = MediaQuery.of(context);
|
||||
return FormBuilder(
|
||||
key: formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(children: [
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: S.of(context).contactName),
|
||||
controller: nameController,
|
||||
validator: _checkName,
|
||||
child: Container(
|
||||
width: mq.size.width,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration:
|
||||
InputDecoration(labelText: S.of(context).contactName),
|
||||
controller: nameController,
|
||||
validator: _checkName,
|
||||
),
|
||||
AddressInput(widget.contact.id, S.of(context).address, address,
|
||||
(addr) {
|
||||
address = addr ?? "";
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
AddressInput(widget.contact.id, S.of(context).address, address,
|
||||
(addr) {
|
||||
address = addr ?? "";
|
||||
})
|
||||
])));
|
||||
));
|
||||
}
|
||||
|
||||
onOK() {
|
||||
|
@ -198,7 +207,7 @@ class AddressState extends State<AddressInput> {
|
|||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(labelText: widget.labelText),
|
||||
minLines: 4,
|
||||
minLines: 8,
|
||||
maxLines: null,
|
||||
keyboardType: TextInputType.multiline,
|
||||
controller: _addressController,
|
||||
|
@ -236,7 +245,6 @@ Future<void> addContact(BuildContext context, ContactT? c) async {
|
|||
final contact = await showDialog<ContactT>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
contentPadding: EdgeInsets.all(16),
|
||||
title: Text(c?.name != null ? s.editContact : s.addContact),
|
||||
content: ContactForm(c ?? ContactT(), key: key),
|
||||
actions: confirmButtons(context, () {
|
||||
|
|
|
@ -78,28 +78,35 @@ class DevPageState extends State<DevPage> {
|
|||
final nameController = TextEditingController();
|
||||
final keyController = TextEditingController();
|
||||
final formKey = GlobalKey<FormBuilderState>();
|
||||
final mq = MediaQuery.of(context);
|
||||
await showDialog(
|
||||
context: this.context,
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: Text("Import YFVK"),
|
||||
insetPadding: EdgeInsets.all(64),
|
||||
content: FormBuilder(
|
||||
key: formKey,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: 'Account Name'),
|
||||
controller: nameController,
|
||||
),
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: 'Key'),
|
||||
controller: keyController,
|
||||
minLines: 8,
|
||||
maxLines: 16,
|
||||
validator: (k) => _validateYFVK(nameController.text, k),
|
||||
),
|
||||
],
|
||||
child: Container(
|
||||
width: mq.size.width,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration:
|
||||
InputDecoration(labelText: 'Account Name'),
|
||||
controller: nameController,
|
||||
),
|
||||
TextFormField(
|
||||
decoration: InputDecoration(labelText: 'Key'),
|
||||
controller: keyController,
|
||||
minLines: 16,
|
||||
maxLines: null,
|
||||
validator: (k) =>
|
||||
_validateYFVK(nameController.text, k),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
actions: confirmButtons(context, () {
|
||||
|
|
Loading…
Reference in New Issue