mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
Flutter upgrade
This commit is contained in:
@@ -3,13 +3,13 @@ import 'package:cake_wallet/src/screens/settings/attributes.dart';
|
||||
|
||||
class SettingsItem {
|
||||
SettingsItem(
|
||||
{this.onTaped,
|
||||
this.title,
|
||||
this.link,
|
||||
this.image,
|
||||
this.widget,
|
||||
this.attribute,
|
||||
this.widgetBuilder});
|
||||
{required this.onTaped,
|
||||
required this.title,
|
||||
required this.link,
|
||||
required this.image,
|
||||
required this.widget,
|
||||
required this.attribute,
|
||||
required this.widgetBuilder});
|
||||
|
||||
final VoidCallback onTaped;
|
||||
final String title;
|
||||
|
||||
@@ -28,7 +28,9 @@ class SettingsPage extends BasePage {
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
// FIX-ME: Added `context` it was not used here before, maby bug ?
|
||||
return SectionStandardList(
|
||||
context: context,
|
||||
sectionCount: settingsViewModel.sections.length,
|
||||
itemCounter: (int sectionIndex) {
|
||||
if (sectionIndex < settingsViewModel.sections.length) {
|
||||
@@ -42,7 +44,7 @@ class SettingsPage extends BasePage {
|
||||
|
||||
if (item is PickerListItem) {
|
||||
return Observer(builder: (_) {
|
||||
return SettingsPickerCell<dynamic>(
|
||||
return SettingsPickerCell<Object>(
|
||||
displayItem: item.displayItem,
|
||||
title: item.title,
|
||||
selectedItem: item.selectedItem(),
|
||||
|
||||
@@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
|
||||
class SettingsCellWithArrow extends StandardListRow {
|
||||
SettingsCellWithArrow({@required String title, @required Function(BuildContext context) handler})
|
||||
SettingsCellWithArrow({required String title, required Function(BuildContext context)? handler})
|
||||
: super(title: title, isSelected: false, onTap: handler);
|
||||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) =>
|
||||
Image.asset('assets/images/select_arrow.png',
|
||||
color: Theme.of(context).primaryTextTheme.overline.color);
|
||||
color: Theme.of(context).primaryTextTheme!.overline!.color!);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import 'package:cake_wallet/view_model/settings/choices_list_item.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SettingsChoicesCell extends StatelessWidget {
|
||||
const SettingsChoicesCell(this.choicesListItem, {Key key}) : super(key: key);
|
||||
const SettingsChoicesCell(this.choicesListItem, {Key? key}) : super(key: key);
|
||||
|
||||
final ChoicesListItem choicesListItem;
|
||||
|
||||
@@ -22,7 +22,7 @@ class SettingsChoicesCell extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -34,7 +34,7 @@ class SettingsChoicesCell extends StatelessWidget {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
color: Theme.of(context).accentTextTheme.display2.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline3!.color!,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -48,12 +48,12 @@ class SettingsChoicesCell extends StatelessWidget {
|
||||
padding: EdgeInsets.symmetric(horizontal: 32, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
color: isSelected ? Theme.of(context).accentTextTheme.body2.color : null,
|
||||
color: isSelected ? Theme.of(context).accentTextTheme!.bodyText1!.color! : null,
|
||||
),
|
||||
child: Text(
|
||||
choicesListItem.displayItem?.call(e) ?? e.toString(),
|
||||
style: TextStyle(
|
||||
color: isSelected ? Colors.white : Theme.of(context).primaryTextTheme.caption.color,
|
||||
color: isSelected ? Colors.white : Theme.of(context).primaryTextTheme!.caption!.color!,
|
||||
fontWeight: isSelected ? FontWeight.w700 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,21 +5,22 @@ import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SettingsLinkProviderCell extends StandardListRow {
|
||||
SettingsLinkProviderCell(
|
||||
{@required String title,
|
||||
@required this.icon,
|
||||
this.iconColor,
|
||||
@required this.link,
|
||||
@required this.linkTitle})
|
||||
{required String title,
|
||||
required this.link,
|
||||
required this.linkTitle,
|
||||
this.icon,
|
||||
this.iconColor})
|
||||
: super(title: title, isSelected: false, onTap: (BuildContext context) => _launchUrl(link) );
|
||||
|
||||
final String icon;
|
||||
|
||||
final String link;
|
||||
final String linkTitle;
|
||||
final Color iconColor;
|
||||
final String? icon;
|
||||
final Color? iconColor;
|
||||
|
||||
@override
|
||||
Widget buildLeading(BuildContext context) =>
|
||||
icon != null ? Image.asset(icon, color: iconColor, height: 30, width: 30) : null;
|
||||
Widget? buildLeading(BuildContext context) =>
|
||||
icon != null ? Image.asset(icon!, color: iconColor, height: 30, width: 30) : null;
|
||||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) => Text(linkTitle,
|
||||
|
||||
@@ -3,12 +3,12 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/picker.dart';
|
||||
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||
|
||||
class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
class SettingsPickerCell<ItemType extends Object> extends StandardListRow {
|
||||
SettingsPickerCell(
|
||||
{@required String title,
|
||||
@required this.displayItem,
|
||||
this.selectedItem,
|
||||
this.items,
|
||||
{required String title,
|
||||
required this.selectedItem,
|
||||
required this.items,
|
||||
this.displayItem,
|
||||
this.images,
|
||||
this.searchHintText,
|
||||
this.isGridView = false,
|
||||
@@ -28,7 +28,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
selectedAtIndex: selectedAtIndex,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
onItemSelected: (ItemType item) => onItemSelected?.call(item),
|
||||
images: images,
|
||||
images: images ?? const <Image>[],
|
||||
isSeparated: false,
|
||||
hintText: searchHintText,
|
||||
isGridView: isGridView,
|
||||
@@ -40,12 +40,12 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
|
||||
final ItemType selectedItem;
|
||||
final List<ItemType> items;
|
||||
final void Function(ItemType item) onItemSelected;
|
||||
final String Function(ItemType item) displayItem;
|
||||
final List<Image> images;
|
||||
final String searchHintText;
|
||||
final void Function(ItemType item)? onItemSelected;
|
||||
final String Function(ItemType item)? displayItem;
|
||||
final List<Image>? images;
|
||||
final String? searchHintText;
|
||||
final bool isGridView;
|
||||
final bool Function(ItemType, String) matchingCriteria;
|
||||
final bool Function(ItemType, String)? matchingCriteria;
|
||||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) {
|
||||
@@ -53,7 +53,7 @@ class SettingsPickerCell<ItemType> extends StandardListRow {
|
||||
displayItem?.call(selectedItem) ?? selectedItem.toString(),
|
||||
textAlign: TextAlign.right,
|
||||
style: TextStyle(
|
||||
fontSize: 14.0, fontWeight: FontWeight.w500, color: Theme.of(context).primaryTextTheme.overline.color),
|
||||
fontSize: 14.0, fontWeight: FontWeight.w500, color: Theme.of(context).primaryTextTheme!.overline!.color!),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,13 @@ import 'package:cake_wallet/src/widgets/standart_switch.dart';
|
||||
|
||||
class SettingsSwitcherCell extends StandardListRow {
|
||||
SettingsSwitcherCell(
|
||||
{@required String title, @required this.value, this.onValueChange})
|
||||
{required String title, required this.value, this.onValueChange})
|
||||
: super(title: title, isSelected: false);
|
||||
|
||||
final bool value;
|
||||
final void Function(BuildContext context, bool value) onValueChange;
|
||||
final void Function(BuildContext context, bool value)? onValueChange;
|
||||
|
||||
@override
|
||||
Widget buildTrailing(BuildContext context) => StandartSwitch(
|
||||
value: value, onTaped: () => onValueChange(context, !value));
|
||||
value: value, onTaped: () => onValueChange?.call(context, !value));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SettingsVersionCell extends StatelessWidget {
|
||||
SettingsVersionCell({@required this.title});
|
||||
SettingsVersionCell({required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@@ -18,7 +18,7 @@ class SettingsVersionCell extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color
|
||||
color: Theme.of(context).primaryTextTheme!.overline!.color!
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user