Flutter upgrade

This commit is contained in:
M
2022-10-12 13:09:57 -04:00
parent c921ad890a
commit 1beb18b045
505 changed files with 6657 additions and 5875 deletions
+46 -43
View File
@@ -24,7 +24,7 @@ class ContactListPage extends BasePage {
String get title => S.current.address_book;
@override
Widget trailing(BuildContext context) {
Widget? trailing(BuildContext context) {
if (!isEditable) {
return null;
}
@@ -34,18 +34,19 @@ class ContactListPage extends BasePage {
height: 32.0,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).accentTextTheme.caption.color),
color: Theme.of(context).accentTextTheme!.caption!.color!),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Icon(Icons.add,
color: Theme.of(context).primaryTextTheme.title.color,
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
size: 22.0),
ButtonTheme(
minWidth: 32.0,
height: 32.0,
child: FlatButton(
shape: CircleBorder(),
child: TextButton(
// FIX-ME: Style
//shape: CircleBorder(),
onPressed: () async {
await Navigator.of(context)
.pushNamed(Routes.addressBookAddContact);
@@ -65,9 +66,9 @@ class ContactListPage extends BasePage {
return CollapsibleSectionList(
context: context,
sectionCount: 2,
themeColor: Theme.of(context).primaryTextTheme.title.color,
themeColor: Theme.of(context).primaryTextTheme!.headline6!.color!,
dividerThemeColor:
Theme.of(context).primaryTextTheme.caption.decorationColor,
Theme.of(context).primaryTextTheme!.caption!.decorationColor!,
sectionTitleBuilder: (_, int sectionIndex) {
var title = 'Contacts';
@@ -90,36 +91,37 @@ class ContactListPage extends BasePage {
final contact = contactListViewModel.contacts[index];
final content = generateRaw(context, contact);
// FIX-ME: Slidable
return content;
// return !isEditable
// ? content
// : Slidable(
// key: Key('${contact.key}'),
// actionPane: SlidableDrawerActionPane(),
// child: content,
// secondaryActions: <Widget>[
// IconSlideAction(
// caption: S.of(context).edit,
// color: Colors.blue,
// icon: Icons.edit,
// onTap: () async => await Navigator.of(context)
// .pushNamed(Routes.addressBookAddContact,
// arguments: contact),
// ),
// IconSlideAction(
// caption: S.of(context).delete,
// color: Colors.red,
// icon: CupertinoIcons.delete,
// onTap: () async {
// final isDelete =
// await showAlertDialog(context) ?? false;
return !isEditable
? content
: Slidable(
key: Key('${contact.key}'),
actionPane: SlidableDrawerActionPane(),
child: content,
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).edit,
color: Colors.blue,
icon: Icons.edit,
onTap: () async => await Navigator.of(context)
.pushNamed(Routes.addressBookAddContact,
arguments: contact),
),
IconSlideAction(
caption: S.of(context).delete,
color: Colors.red,
icon: CupertinoIcons.delete,
onTap: () async {
final isDelete =
await showAlertDialog(context) ?? false;
if (isDelete) {
await contactListViewModel.delete(contact);
}
},
),
]);
// if (isDelete) {
// await contactListViewModel.delete(contact);
// }
// },
// ),
// ]);
},
);
},
@@ -163,7 +165,7 @@ class ContactListPage extends BasePage {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: Theme.of(context).primaryTextTheme.title.color),
color: Theme.of(context).primaryTextTheme!.headline6!.color!),
),
)
)
@@ -173,8 +175,9 @@ class ContactListPage extends BasePage {
);
}
Image _getCurrencyImage(CryptoCurrency currency) {
Image image;
Image? _getCurrencyImage(CryptoCurrency currency) {
Image? image;
switch (currency) {
case CryptoCurrency.xmr:
image =
@@ -236,7 +239,7 @@ class ContactListPage extends BasePage {
}
Future<bool> showAlertDialog(BuildContext context) async {
return await showPopUp(
return await showPopUp<bool>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
@@ -246,12 +249,12 @@ class ContactListPage extends BasePage {
leftButtonText: S.of(context).cancel,
actionRightButton: () => Navigator.of(context).pop(true),
actionLeftButton: () => Navigator.of(context).pop(false));
});
}) ?? false;
}
Future<bool> showNameAndAddressDialog(
BuildContext context, String name, String address) async {
return await showPopUp(
return await showPopUp<bool>(
context: context,
builder: (BuildContext context) {
return AlertWithTwoActions(
@@ -261,6 +264,6 @@ class ContactListPage extends BasePage {
leftButtonText: S.of(context).cancel,
actionRightButton: () => Navigator.of(context).pop(true),
actionLeftButton: () => Navigator.of(context).pop(false));
});
}) ?? false;
}
}
+8 -6
View File
@@ -48,7 +48,7 @@ class ContactPage extends BasePage {
@override
Widget body(BuildContext context) {
final downArrow = Image.asset('assets/images/arrow_bottom_purple_icon.png',
color: Theme.of(context).primaryTextTheme.overline.color, height: 8);
color: Theme.of(context).primaryTextTheme!.overline!.color!, height: 8);
reaction((_) => contactViewModel.state, (ExecutionState state) {
if (state is FailureState) {
@@ -98,9 +98,9 @@ class ContactPage extends BasePage {
AddressTextFieldOption.paste,
AddressTextFieldOption.qrCode,
],
buttonColor: Theme.of(context).accentTextTheme.display2.color,
buttonColor: Theme.of(context).accentTextTheme!.headline3!.color!,
iconColor: PaletteDark.gray,
borderColor: Theme.of(context).primaryTextTheme.title.backgroundColor,
borderColor: Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!,
validator: TextValidator()
// AddressValidator(
// type: contactViewModel.currency),
@@ -129,14 +129,14 @@ class ContactPage extends BasePage {
child: Observer(
builder: (_) => PrimaryButton(
onPressed: () async {
if (!_formKey.currentState.validate()) {
if (_formKey.currentState != null && !_formKey.currentState!.validate()) {
return;
}
await contactViewModel.save();
},
text: S.of(context).save,
color: Theme.of(context).accentTextTheme.body2.color,
color: Theme.of(context).accentTextTheme!.bodyText1!.color!,
textColor: Colors.white,
isDisabled: !contactViewModel.isReady)))
],
@@ -147,7 +147,9 @@ class ContactPage extends BasePage {
showPopUp<void>(
builder: (_) => CurrencyPicker(
selectedAtIndex:
contactViewModel.currencies.indexOf(contactViewModel.currency),
contactViewModel.currency != null
? contactViewModel.currencies.indexOf(contactViewModel.currency!)
: 0,
items: contactViewModel.currencies,
title: S.of(context).please_select,
hintText: S.of(context).search_currency,