mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-19 05:58:50 +02:00
Flutter upgrade
This commit is contained in:
@@ -9,7 +9,7 @@ enum AddressTextFieldOption { paste, qrCode, addressBook }
|
||||
|
||||
class AddressTextField extends StatelessWidget {
|
||||
AddressTextField(
|
||||
{@required this.controller,
|
||||
{required this.controller,
|
||||
this.isActive = true,
|
||||
this.placeholder,
|
||||
this.options = const [
|
||||
@@ -32,21 +32,21 @@ class AddressTextField extends StatelessWidget {
|
||||
static const prefixIconHeight = 34.0;
|
||||
static const spaceBetweenPrefixIcons = 10.0;
|
||||
|
||||
final TextEditingController controller;
|
||||
final TextEditingController? controller;
|
||||
final bool isActive;
|
||||
final String placeholder;
|
||||
final Function(Uri) onURIScanned;
|
||||
final String? placeholder;
|
||||
final Function(Uri)? onURIScanned;
|
||||
final List<AddressTextFieldOption> options;
|
||||
final FormFieldValidator<String> validator;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final bool isBorderExist;
|
||||
final Color buttonColor;
|
||||
final Color borderColor;
|
||||
final Color iconColor;
|
||||
final TextStyle textStyle;
|
||||
final TextStyle hintStyle;
|
||||
final FocusNode focusNode;
|
||||
final Function(BuildContext context) onPushPasteButton;
|
||||
final Function(BuildContext context) onPushAddressBookButton;
|
||||
final Color? buttonColor;
|
||||
final Color? borderColor;
|
||||
final Color? iconColor;
|
||||
final TextStyle? textStyle;
|
||||
final TextStyle? hintStyle;
|
||||
final FocusNode? focusNode;
|
||||
final Function(BuildContext context)? onPushPasteButton;
|
||||
final Function(BuildContext context)? onPushAddressBookButton;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -60,7 +60,7 @@ class AddressTextField extends StatelessWidget {
|
||||
style: textStyle ??
|
||||
TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!),
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: SizedBox(
|
||||
width: prefixIconWidth * options.length +
|
||||
@@ -112,18 +112,18 @@ class AddressTextField extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ??
|
||||
Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.color,
|
||||
.accentTextTheme!
|
||||
.headline6!
|
||||
.color!,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/paste_ios.png',
|
||||
color: iconColor ??
|
||||
Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor,
|
||||
.primaryTextTheme!
|
||||
.headline4!
|
||||
.decorationColor!,
|
||||
)),
|
||||
)),
|
||||
],
|
||||
@@ -139,18 +139,18 @@ class AddressTextField extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ??
|
||||
Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.color,
|
||||
.accentTextTheme!
|
||||
.headline6!
|
||||
.color!,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/qr_code_icon.png',
|
||||
color: iconColor ??
|
||||
Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor,
|
||||
.primaryTextTheme!
|
||||
.headline4!
|
||||
.decorationColor!,
|
||||
)),
|
||||
))
|
||||
],
|
||||
@@ -168,18 +168,18 @@ class AddressTextField extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: buttonColor ??
|
||||
Theme.of(context)
|
||||
.accentTextTheme
|
||||
.title
|
||||
.color,
|
||||
.accentTextTheme!
|
||||
.headline6!
|
||||
.color!,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset(
|
||||
'assets/images/open_book.png',
|
||||
color: iconColor ??
|
||||
Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor,
|
||||
.primaryTextTheme!
|
||||
.headline4!
|
||||
.decorationColor!,
|
||||
)),
|
||||
))
|
||||
]
|
||||
@@ -191,27 +191,17 @@ class AddressTextField extends StatelessWidget {
|
||||
}
|
||||
|
||||
Future<void> _presentQRScanner(BuildContext context) async {
|
||||
final code = await presentQRScanner();
|
||||
if (code.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final code = await presentQRScanner();
|
||||
if (code.isEmpty) {
|
||||
return;
|
||||
}
|
||||
final uri = Uri.parse(code);
|
||||
var address = '';
|
||||
|
||||
if (uri == null) {
|
||||
controller.text = code;
|
||||
return;
|
||||
}
|
||||
|
||||
address = uri.path;
|
||||
controller.text = address;
|
||||
|
||||
if (onURIScanned != null) {
|
||||
onURIScanned(uri);
|
||||
}
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
controller?.text = uri.path;
|
||||
onURIScanned?.call(uri);
|
||||
} catch(_){
|
||||
controller?.text = code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,18 +210,17 @@ class AddressTextField extends StatelessWidget {
|
||||
.pushNamed(Routes.pickerAddressBook);
|
||||
|
||||
if (contact is ContactBase && contact.address != null) {
|
||||
controller.text = contact.address;
|
||||
controller?.text = contact.address;
|
||||
onPushAddressBookButton?.call(context);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _pasteAddress(BuildContext context) async {
|
||||
String address;
|
||||
|
||||
await Clipboard.getData('text/plain').then((value) => address = value?.text);
|
||||
|
||||
if (address?.isNotEmpty ?? false) {
|
||||
controller.text = address;
|
||||
final clipboard = await Clipboard.getData('text/plain');
|
||||
final address = clipboard?.text ?? '';
|
||||
|
||||
if (address.isNotEmpty) {
|
||||
controller?.text = address;
|
||||
}
|
||||
|
||||
onPushPasteButton?.call(context);
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class AlertBackground extends StatelessWidget {
|
||||
AlertBackground({@required this.child});
|
||||
AlertBackground({required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
class AlertCloseButton extends StatelessWidget {
|
||||
AlertCloseButton({this.image});
|
||||
|
||||
final Image image;
|
||||
final Image? image;
|
||||
|
||||
final closeButton = Image.asset(
|
||||
'assets/images/close.png',
|
||||
|
||||
@@ -3,10 +3,10 @@ import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
|
||||
|
||||
class AlertWithOneAction extends BaseAlertDialog {
|
||||
AlertWithOneAction({
|
||||
@required this.alertTitle,
|
||||
@required this.alertContent,
|
||||
@required this.buttonText,
|
||||
@required this.buttonAction,
|
||||
required this.alertTitle,
|
||||
required this.alertContent,
|
||||
required this.buttonText,
|
||||
required this.buttonAction,
|
||||
this.alertBarrierDismissible = true
|
||||
});
|
||||
|
||||
@@ -31,21 +31,22 @@ class AlertWithOneAction extends BaseAlertDialog {
|
||||
width: 300,
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.bodyText2!.backgroundColor!,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
onPressed: buttonAction,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
// FIX-ME: Style
|
||||
//highlightColor: Colors.transparent,
|
||||
//splashColor: Colors.transparent,
|
||||
child: Text(
|
||||
buttonText,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.body1
|
||||
.backgroundColor,
|
||||
color: Theme.of(context).primaryTextTheme!.bodyText2!
|
||||
.backgroundColor!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -4,16 +4,16 @@ import 'package:flutter/cupertino.dart';
|
||||
|
||||
class AlertWithTwoActions extends BaseAlertDialog {
|
||||
AlertWithTwoActions({
|
||||
@required this.alertTitle,
|
||||
@required this.alertContent,
|
||||
@required this.leftButtonText,
|
||||
@required this.rightButtonText,
|
||||
@required this.actionLeftButton,
|
||||
@required this.actionRightButton,
|
||||
required this.alertTitle,
|
||||
required this.alertContent,
|
||||
required this.leftButtonText,
|
||||
required this.rightButtonText,
|
||||
required this.actionLeftButton,
|
||||
required this.actionRightButton,
|
||||
this.alertBarrierDismissible = true,
|
||||
this.isDividerExist = false,
|
||||
this.leftActionColor,
|
||||
this.rightActionColor,
|
||||
// this.leftActionColor,
|
||||
// this.rightActionColor,
|
||||
});
|
||||
|
||||
final String alertTitle;
|
||||
@@ -23,8 +23,8 @@ class AlertWithTwoActions extends BaseAlertDialog {
|
||||
final VoidCallback actionLeftButton;
|
||||
final VoidCallback actionRightButton;
|
||||
final bool alertBarrierDismissible;
|
||||
final Color leftActionColor;
|
||||
final Color rightActionColor;
|
||||
// final Color leftActionColor;
|
||||
// final Color rightActionColor;
|
||||
final bool isDividerExist;
|
||||
|
||||
@override
|
||||
@@ -41,10 +41,10 @@ class AlertWithTwoActions extends BaseAlertDialog {
|
||||
VoidCallback get actionRight => actionRightButton;
|
||||
@override
|
||||
bool get barrierDismissible => alertBarrierDismissible;
|
||||
@override
|
||||
Color get leftButtonColor => leftActionColor;
|
||||
@override
|
||||
Color get rightButtonColor => rightActionColor;
|
||||
// @override
|
||||
// Color get leftButtonColor => leftActionColor;
|
||||
// @override
|
||||
// Color get rightButtonColor => rightActionColor;
|
||||
@override
|
||||
bool get isDividerExists => isDividerExist;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 20,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
);
|
||||
@@ -34,7 +34,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
);
|
||||
@@ -48,13 +48,14 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 6, right: 6),
|
||||
color: Theme.of(context).accentTextTheme.body2.decorationColor,
|
||||
color: Theme.of(context).accentTextTheme!.bodyText1!.decorationColor!,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
onPressed: actionLeft,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
// FIX-ME: Style
|
||||
//highlightColor: Colors.transparent,
|
||||
//splashColor: Colors.transparent,
|
||||
child: Text(
|
||||
leftActionButtonText,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -62,7 +63,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.body2.backgroundColor,
|
||||
color: Theme.of(context).primaryTextTheme!.bodyText1!.backgroundColor!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
@@ -77,13 +78,14 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
child: Container(
|
||||
height: 52,
|
||||
padding: EdgeInsets.only(left: 6, right: 6),
|
||||
color: Theme.of(context).accentTextTheme.body1.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.bodyText2!.backgroundColor!,
|
||||
child: ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
onPressed: actionRight,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
// FIX-ME: Style
|
||||
//highlightColor: Colors.transparent,
|
||||
//splashColor: Colors.transparent,
|
||||
child: Text(
|
||||
rightActionButtonText,
|
||||
textAlign: TextAlign.center,
|
||||
@@ -91,7 +93,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
fontSize: 15,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.body1.backgroundColor,
|
||||
color: Theme.of(context).primaryTextTheme!.bodyText2!.backgroundColor!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
)),
|
||||
@@ -118,7 +120,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
child: Container(
|
||||
width: 300,
|
||||
color: Theme.of(context).accentTextTheme.title.decorationColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.decorationColor!,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
|
||||
@@ -7,7 +7,7 @@ class BaseTextFormField extends StatelessWidget {
|
||||
this.keyboardType = TextInputType.text,
|
||||
this.textInputAction = TextInputAction.done,
|
||||
this.textAlign = TextAlign.start,
|
||||
this.autovalidate = false,
|
||||
this.autovalidateMode,
|
||||
this.hintText = '',
|
||||
this.maxLines = 1,
|
||||
this.inputFormatters,
|
||||
@@ -29,30 +29,30 @@ class BaseTextFormField extends StatelessWidget {
|
||||
this.initialValue,
|
||||
this.borderWidth = 1.0});
|
||||
|
||||
final TextEditingController controller;
|
||||
final TextInputType keyboardType;
|
||||
final TextInputAction textInputAction;
|
||||
final TextEditingController? controller;
|
||||
final TextInputType? keyboardType;
|
||||
final TextInputAction? textInputAction;
|
||||
final TextAlign textAlign;
|
||||
final bool autovalidate;
|
||||
final String hintText;
|
||||
final int maxLines;
|
||||
final List<TextInputFormatter> inputFormatters;
|
||||
final Color textColor;
|
||||
final Color hintColor;
|
||||
final Color borderColor;
|
||||
final Widget prefix;
|
||||
final Widget prefixIcon;
|
||||
final Widget suffix;
|
||||
final Widget suffixIcon;
|
||||
final bool enabled;
|
||||
final FormFieldValidator<String> validator;
|
||||
final TextStyle placeholderTextStyle;
|
||||
final TextStyle textStyle;
|
||||
final int maxLength;
|
||||
final FocusNode focusNode;
|
||||
final AutovalidateMode? autovalidateMode;
|
||||
final String? hintText;
|
||||
final int? maxLines;
|
||||
final List<TextInputFormatter>? inputFormatters;
|
||||
final Color? textColor;
|
||||
final Color? hintColor;
|
||||
final Color? borderColor;
|
||||
final Widget? prefix;
|
||||
final Widget? prefixIcon;
|
||||
final Widget? suffix;
|
||||
final Widget? suffixIcon;
|
||||
final bool? enabled;
|
||||
final FormFieldValidator<String>? validator;
|
||||
final TextStyle? placeholderTextStyle;
|
||||
final TextStyle? textStyle;
|
||||
final int? maxLength;
|
||||
final FocusNode? focusNode;
|
||||
final bool readOnly;
|
||||
final bool enableInteractiveSelection;
|
||||
final String initialValue;
|
||||
final bool? enableInteractiveSelection;
|
||||
final String? initialValue;
|
||||
final double borderWidth;
|
||||
|
||||
@override
|
||||
@@ -66,7 +66,7 @@ class BaseTextFormField extends StatelessWidget {
|
||||
keyboardType: keyboardType,
|
||||
textInputAction: textInputAction,
|
||||
textAlign: textAlign,
|
||||
autovalidate: autovalidate,
|
||||
autovalidateMode: autovalidateMode,
|
||||
maxLines: maxLines,
|
||||
inputFormatters: inputFormatters,
|
||||
enabled: enabled,
|
||||
@@ -75,7 +75,7 @@ class BaseTextFormField extends StatelessWidget {
|
||||
TextStyle(
|
||||
fontSize: 16.0,
|
||||
color:
|
||||
textColor ?? Theme.of(context).primaryTextTheme.title.color),
|
||||
textColor ?? Theme.of(context).primaryTextTheme!.headline6!.color!),
|
||||
decoration: InputDecoration(
|
||||
prefix: prefix,
|
||||
prefixIcon: prefixIcon,
|
||||
@@ -89,17 +89,17 @@ class BaseTextFormField extends StatelessWidget {
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ??
|
||||
Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!,
|
||||
width: borderWidth)),
|
||||
disabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ??
|
||||
Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!,
|
||||
width: borderWidth)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: borderColor ??
|
||||
Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||
Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!,
|
||||
width: borderWidth))),
|
||||
validator: validator,
|
||||
);
|
||||
|
||||
@@ -6,13 +6,17 @@ import 'package:cake_wallet/monero/monero.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
|
||||
class BlockchainHeightWidget extends StatefulWidget {
|
||||
BlockchainHeightWidget({GlobalKey key, this.onHeightChange, this.focusNode,
|
||||
this.onHeightOrDateEntered, this.hasDatePicker = true})
|
||||
BlockchainHeightWidget({
|
||||
GlobalKey? key,
|
||||
this.onHeightChange,
|
||||
this.focusNode,
|
||||
this.onHeightOrDateEntered,
|
||||
this.hasDatePicker = true})
|
||||
: super(key: key);
|
||||
|
||||
final Function(int) onHeightChange;
|
||||
final Function(bool) onHeightOrDateEntered;
|
||||
final FocusNode focusNode;
|
||||
final Function(int)? onHeightChange;
|
||||
final Function(bool)? onHeightOrDateEntered;
|
||||
final FocusNode? focusNode;
|
||||
final bool hasDatePicker;
|
||||
|
||||
@override
|
||||
@@ -76,7 +80,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.title.color),
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
@@ -120,7 +124,7 @@ class BlockchainHeightState extends State<BlockchainHeightWidget> {
|
||||
lastDate: now);
|
||||
|
||||
if (date != null) {
|
||||
final height = monero.getHeigthByDate(date: date);
|
||||
final height = monero!.getHeigthByDate(date: date);
|
||||
setState(() {
|
||||
dateController.text = DateFormat('yyyy-MM-dd').format(date);
|
||||
restoreHeightController.text = '$height';
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class CakeScrollbar extends StatelessWidget {
|
||||
CakeScrollbar({
|
||||
@required this.backgroundHeight,
|
||||
@required this.thumbHeight,
|
||||
@required this.fromTop,
|
||||
required this.backgroundHeight,
|
||||
required this.thumbHeight,
|
||||
required this.fromTop,
|
||||
this.rightOffset = 6,
|
||||
this.backgroundColor,
|
||||
this.thumbColor,
|
||||
@@ -16,8 +16,8 @@ class CakeScrollbar extends StatelessWidget {
|
||||
final double fromTop;
|
||||
final double width;
|
||||
final double rightOffset;
|
||||
final Color backgroundColor;
|
||||
final Color thumbColor;
|
||||
final Color? backgroundColor;
|
||||
final Color? thumbColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -27,7 +27,7 @@ class CakeScrollbar extends StatelessWidget {
|
||||
height: backgroundHeight,
|
||||
width: width,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ?? Theme.of(context).textTheme.body1.decorationColor,
|
||||
color: backgroundColor ?? Theme.of(context).textTheme!.bodyText2!.decorationColor!,
|
||||
borderRadius: BorderRadius.all(Radius.circular(3))),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
@@ -38,7 +38,7 @@ class CakeScrollbar extends StatelessWidget {
|
||||
height: thumbHeight,
|
||||
width: width,
|
||||
decoration: BoxDecoration(
|
||||
color: thumbColor ?? Theme.of(context).textTheme.body1.color,
|
||||
color: thumbColor ?? Theme.of(context).textTheme!.bodyText2!.color!,
|
||||
borderRadius: BorderRadius.all(Radius.circular(3))),
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
import 'dart:ui';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class CheckBoxPicker extends StatefulWidget {
|
||||
CheckBoxPicker({
|
||||
@required this.items,
|
||||
@required this.onChanged,
|
||||
this.title,
|
||||
required this.items,
|
||||
required this.onChanged,
|
||||
required this.title,
|
||||
this.displayItem,
|
||||
this.isSeparated = true,
|
||||
});
|
||||
|
||||
final List<CheckBoxItem> items;
|
||||
final String title;
|
||||
final Widget Function(CheckBoxItem) displayItem;
|
||||
final Widget Function(CheckBoxItem)? displayItem;
|
||||
final bool isSeparated;
|
||||
final Function(int, bool) onChanged;
|
||||
|
||||
@@ -61,7 +58,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
child: Container(
|
||||
color: Theme.of(context).accentTextTheme.title.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.65,
|
||||
@@ -98,14 +95,14 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||
|
||||
Widget itemsList() {
|
||||
return Container(
|
||||
color: Theme.of(context).accentTextTheme.headline6.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.zero,
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
separatorBuilder: (context, index) => widget.isSeparated
|
||||
? Divider(
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
||||
height: 1,
|
||||
)
|
||||
: const SizedBox(),
|
||||
@@ -124,13 +121,13 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||
},
|
||||
child: Container(
|
||||
height: 55,
|
||||
color: Theme.of(context).accentTextTheme.headline6.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: CheckboxListTile(
|
||||
value: item.value,
|
||||
activeColor: item.value
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).accentTextTheme.subhead.decorationColor,
|
||||
: Theme.of(context).accentTextTheme!.subtitle1!.decorationColor!,
|
||||
checkColor: Colors.white,
|
||||
title: widget.displayItem?.call(item) ??
|
||||
Text(
|
||||
@@ -141,11 +138,15 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||
fontWeight: FontWeight.w600,
|
||||
color: item.isDisabled
|
||||
? Colors.grey.withOpacity(0.5)
|
||||
: Theme.of(context).primaryTextTheme.title.color,
|
||||
: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
onChanged: (bool value) {
|
||||
onChanged: (bool? value) {
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.value = value;
|
||||
widget.onChanged(index, value);
|
||||
setState(() {});
|
||||
|
||||
@@ -5,9 +5,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class CheckboxWidget extends StatefulWidget {
|
||||
CheckboxWidget({
|
||||
@required this.value,
|
||||
@required this.caption,
|
||||
@required this.onChanged});
|
||||
required this.value,
|
||||
required this.caption,
|
||||
required this.onChanged});
|
||||
|
||||
final bool value;
|
||||
final String caption;
|
||||
@@ -42,12 +42,12 @@ class CheckboxWidgetState extends State<CheckboxWidget> {
|
||||
decoration: BoxDecoration(
|
||||
color: value
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).accentTextTheme.subhead.decorationColor,
|
||||
: Theme.of(context).accentTextTheme!.subtitle1!.decorationColor!,
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
border: Border.all(
|
||||
color: value
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).accentTextTheme.overline.color,
|
||||
: Theme.of(context).accentTextTheme!.overline!.color!,
|
||||
width: 1
|
||||
)
|
||||
),
|
||||
@@ -66,7 +66,7 @@ class CheckboxWidgetState extends State<CheckboxWidget> {
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@@ -3,24 +3,23 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class CollapsibleSectionList extends SectionStandardList {
|
||||
CollapsibleSectionList(
|
||||
{bool hasTopSeparator,
|
||||
BuildContext context,
|
||||
int sectionCount,
|
||||
int Function(int sectionIndex) itemCounter,
|
||||
Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder,
|
||||
Widget Function(BuildContext context, int sectionIndex)
|
||||
sectionTitleBuilder,
|
||||
Color themeColor,
|
||||
Color dividerThemeColor})
|
||||
{required BuildContext context,
|
||||
required int sectionCount,
|
||||
required int Function(int sectionIndex) itemCounter,
|
||||
required Widget Function(BuildContext context, int sectionIndex, int itemIndex) itemBuilder,
|
||||
Color? themeColor,
|
||||
Color? dividerThemeColor,
|
||||
Widget Function(BuildContext context, int sectionIndex)? sectionTitleBuilder,
|
||||
bool hasTopSeparator = false})
|
||||
: super(
|
||||
hasTopSeparator: hasTopSeparator,
|
||||
sectionCount: sectionCount,
|
||||
itemCounter: itemCounter,
|
||||
itemBuilder: itemBuilder,
|
||||
sectionTitleBuilder: sectionTitleBuilder,
|
||||
themeColor: themeColor,
|
||||
dividerThemeColor: dividerThemeColor);
|
||||
context: context,
|
||||
hasTopSeparator: hasTopSeparator,
|
||||
sectionCount: sectionCount,
|
||||
itemCounter: itemCounter,
|
||||
itemBuilder: itemBuilder,
|
||||
sectionTitleBuilder: sectionTitleBuilder,
|
||||
themeColor: themeColor,
|
||||
dividerThemeColor: dividerThemeColor);
|
||||
|
||||
@override
|
||||
List<Widget> transform(
|
||||
@@ -28,12 +27,10 @@ class CollapsibleSectionList extends SectionStandardList {
|
||||
BuildContext context,
|
||||
int sectionCount,
|
||||
int Function(int sectionIndex) itemCounter,
|
||||
Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder,
|
||||
Widget Function(BuildContext context, int sectionIndex)
|
||||
sectionTitleBuilder,
|
||||
themeColor,
|
||||
dividerThemeColor) {
|
||||
Widget Function(BuildContext context, int sectionIndex, int itemIndex) itemBuilder,
|
||||
Widget Function(BuildContext context, int sectionIndex)? sectionTitleBuilder,
|
||||
Color? themeColor,
|
||||
Color? dividerThemeColor) {
|
||||
final items = <Widget>[];
|
||||
|
||||
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
||||
@@ -70,8 +67,10 @@ class CollapsibleSectionList extends SectionStandardList {
|
||||
@override
|
||||
Widget buildTitle(
|
||||
List<Widget> items, int sectionIndex, BuildContext context) {
|
||||
final title = sectionTitleBuilder(context, sectionIndex);
|
||||
return title;
|
||||
if (sectionTitleBuilder == null) {
|
||||
throw Exception('Cannot to build title. sectionTitleBuilder is null');
|
||||
}
|
||||
return sectionTitleBuilder!.call(context, sectionIndex);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -3,15 +3,15 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class DiscountBadge extends StatelessWidget {
|
||||
const DiscountBadge({
|
||||
Key key,
|
||||
this.isAmount = false,
|
||||
@required this.percentage,
|
||||
Key? key,
|
||||
required this.percentage,
|
||||
this.discountBackground,
|
||||
this.isAmount = false,
|
||||
}) : super(key: key);
|
||||
|
||||
final double percentage;
|
||||
final bool isAmount;
|
||||
final AssetImage discountBackground;
|
||||
final AssetImage? discountBackground;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -4,7 +4,10 @@ import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class IntroducingCard extends StatelessWidget {
|
||||
IntroducingCard(
|
||||
{this.borderColor, this.closeCard, this.title, this.subTitle});
|
||||
{required this.borderColor,
|
||||
required this.closeCard,
|
||||
required this.title,
|
||||
required this.subTitle});
|
||||
|
||||
final String title;
|
||||
final String subTitle;
|
||||
@@ -23,7 +26,7 @@ class IntroducingCard extends StatelessWidget {
|
||||
color: borderColor,
|
||||
width: 1,
|
||||
),
|
||||
color: Theme.of(context).textTheme.title.backgroundColor),
|
||||
color: Theme.of(context).textTheme!.headline6!.backgroundColor!),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -41,9 +44,9 @@ class IntroducingCard extends StatelessWidget {
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display3
|
||||
.backgroundColor,
|
||||
.accentTextTheme!
|
||||
.headline2!
|
||||
.backgroundColor!,
|
||||
height: 1),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center),
|
||||
@@ -54,9 +57,9 @@ class IntroducingCard extends StatelessWidget {
|
||||
fontSize: 12,
|
||||
fontFamily: 'Lato',
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display3
|
||||
.backgroundColor,
|
||||
.accentTextTheme!
|
||||
.headline2!
|
||||
.backgroundColor!,
|
||||
height: 1)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,9 +4,9 @@ class MarketPlaceItem extends StatelessWidget {
|
||||
|
||||
|
||||
MarketPlaceItem({
|
||||
@required this.onTap,
|
||||
@required this.title,
|
||||
@required this.subTitle,
|
||||
required this.onTap,
|
||||
required this.title,
|
||||
required this.subTitle,
|
||||
});
|
||||
|
||||
final VoidCallback onTap;
|
||||
@@ -23,7 +23,7 @@ class MarketPlaceItem extends StatelessWidget {
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).textTheme.title.backgroundColor,
|
||||
color: Theme.of(context).textTheme!.headline6!.backgroundColor!,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.20),
|
||||
@@ -37,9 +37,9 @@ class MarketPlaceItem extends StatelessWidget {
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display3
|
||||
.backgroundColor,
|
||||
.accentTextTheme!
|
||||
.headline2!
|
||||
.backgroundColor!,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
@@ -49,9 +49,9 @@ class MarketPlaceItem extends StatelessWidget {
|
||||
subTitle,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.accentTextTheme
|
||||
.display3
|
||||
.backgroundColor,
|
||||
.accentTextTheme!
|
||||
.headline2!
|
||||
.backgroundColor!,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Lato'),
|
||||
)
|
||||
|
||||
@@ -3,11 +3,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
factory NavBar(
|
||||
{BuildContext context,
|
||||
Widget leading,
|
||||
Widget middle,
|
||||
Widget trailing,
|
||||
Color backgroundColor}) {
|
||||
{Widget? leading,
|
||||
Widget? middle,
|
||||
Widget? trailing,
|
||||
Color? backgroundColor}) {
|
||||
|
||||
return NavBar._internal(
|
||||
leading: leading,
|
||||
@@ -18,11 +17,10 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
}
|
||||
|
||||
factory NavBar.withShadow(
|
||||
{BuildContext context,
|
||||
Widget leading,
|
||||
Widget middle,
|
||||
Widget trailing,
|
||||
Color backgroundColor}) {
|
||||
{Widget? leading,
|
||||
Widget? middle,
|
||||
Widget? trailing,
|
||||
Color? backgroundColor}) {
|
||||
|
||||
return NavBar._internal(
|
||||
leading: leading,
|
||||
@@ -52,11 +50,11 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
static const _originalHeight = 44.0; // iOS nav bar height
|
||||
static const _height = 60.0;
|
||||
|
||||
final Widget leading;
|
||||
final Widget middle;
|
||||
final Widget trailing;
|
||||
final Color backgroundColor;
|
||||
final BoxDecoration decoration;
|
||||
final Widget? leading;
|
||||
final Widget? middle;
|
||||
final Widget? trailing;
|
||||
final Color? backgroundColor;
|
||||
final BoxDecoration? decoration;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
|
||||
+25
-26
@@ -1,17 +1,15 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_background.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
|
||||
|
||||
class Picker<Item extends Object> extends StatefulWidget {
|
||||
Picker({
|
||||
@required this.selectedAtIndex,
|
||||
@required this.items,
|
||||
@required this.onItemSelected,
|
||||
required this.selectedAtIndex,
|
||||
required this.items,
|
||||
required this.onItemSelected,
|
||||
this.title,
|
||||
this.displayItem,
|
||||
this.images,
|
||||
this.images = const <Image>[],
|
||||
this.description,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.isGridView = false,
|
||||
@@ -25,15 +23,15 @@ class Picker<Item extends Object> extends StatefulWidget {
|
||||
final int selectedAtIndex;
|
||||
final List<Item> items;
|
||||
final List<Image> images;
|
||||
final String title;
|
||||
final String description;
|
||||
final String? title;
|
||||
final String? description;
|
||||
final Function(Item) onItemSelected;
|
||||
final MainAxisAlignment mainAxisAlignment;
|
||||
final String Function(Item) displayItem;
|
||||
final String Function(Item)? displayItem;
|
||||
final bool isGridView;
|
||||
final bool isSeparated;
|
||||
final String hintText;
|
||||
final bool Function(Item, String) matchingCriteria;
|
||||
final String? hintText;
|
||||
final bool Function(Item, String)? matchingCriteria;
|
||||
|
||||
@override
|
||||
PickerState createState() => PickerState<Item>(items, images, onItemSelected);
|
||||
@@ -80,7 +78,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24),
|
||||
child: Text(
|
||||
widget.title,
|
||||
widget.title!,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
@@ -96,7 +94,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30)),
|
||||
child: Container(
|
||||
color: Theme.of(context).accentTextTheme.title.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.65,
|
||||
@@ -109,12 +107,12 @@ class PickerState<Item> extends State<Picker> {
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: TextFormField(
|
||||
controller: searchController,
|
||||
style: TextStyle(color: Theme.of(context).primaryTextTheme.title.color),
|
||||
style: TextStyle(color: Theme.of(context).primaryTextTheme!.headline6!.color!),
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.hintText,
|
||||
prefixIcon: Image.asset("assets/images/search_icon.png"),
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).accentTextTheme.display2.color,
|
||||
fillColor: Theme.of(context).accentTextTheme!.headline3!.color!,
|
||||
alignLabelWithHint: false,
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
@@ -131,7 +129,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
||||
height: 1,
|
||||
),
|
||||
if (widget.selectedAtIndex != -1) buildSelectedItem(),
|
||||
@@ -149,14 +147,14 @@ class PickerState<Item> extends State<Picker> {
|
||||
left: 24,
|
||||
right: 24,
|
||||
child: Text(
|
||||
widget.description,
|
||||
widget.description!,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'Lato',
|
||||
decoration: TextDecoration.none,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
),
|
||||
),
|
||||
)
|
||||
@@ -180,7 +178,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
|
||||
Widget itemsList() {
|
||||
return Container(
|
||||
color: Theme.of(context).accentTextTheme.headline6.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
||||
child: widget.isGridView
|
||||
? GridView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -200,7 +198,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
shrinkWrap: true,
|
||||
separatorBuilder: (context, index) => widget.isSeparated
|
||||
? Divider(
|
||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.backgroundColor!,
|
||||
height: 1,
|
||||
)
|
||||
: const SizedBox(),
|
||||
@@ -229,7 +227,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
},
|
||||
child: Container(
|
||||
height: 55,
|
||||
color: Theme.of(context).accentTextTheme.headline6.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@@ -241,12 +239,13 @@ class PickerState<Item> extends State<Picker> {
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: image != null ? 12 : 0),
|
||||
child: Text(
|
||||
widget.displayItem?.call(item) ?? item.toString(),
|
||||
// What a hack (item as) ?
|
||||
widget.displayItem?.call(item as Object) ?? item.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
@@ -264,7 +263,7 @@ class PickerState<Item> extends State<Picker> {
|
||||
|
||||
return Container(
|
||||
height: 55,
|
||||
color: Theme.of(context).accentTextTheme.headline6.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline6!.color!,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
@@ -281,13 +280,13 @@ class PickerState<Item> extends State<Picker> {
|
||||
fontSize: 16,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
decoration: TextDecoration.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(Icons.check_circle, color: Theme.of(context).accentTextTheme.body2.color),
|
||||
Icon(Icons.check_circle, color: Theme.of(context).accentTextTheme!.bodyText1!.color!),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -4,17 +4,17 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
const PrimaryButton(
|
||||
{@required this.onPressed,
|
||||
@required this.text,
|
||||
@required this.color,
|
||||
@required this.textColor,
|
||||
{required this.text,
|
||||
required this.color,
|
||||
required this.textColor,
|
||||
this.onPressed,
|
||||
this.isDisabled = false,
|
||||
this.isDottedBorder = false,
|
||||
this.borderColor = Colors.black,
|
||||
this.onDisabledPressed});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final VoidCallback onDisabledPressed;
|
||||
final VoidCallback? onPressed;
|
||||
final VoidCallback? onDisabledPressed;
|
||||
final Color color;
|
||||
final Color textColor;
|
||||
final Color borderColor;
|
||||
@@ -25,19 +25,21 @@ class PrimaryButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final content = ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 52.0,
|
||||
child: FlatButton(
|
||||
//minWidth: double.infinity,
|
||||
//height: 52.0,
|
||||
child: TextButton(
|
||||
onPressed: isDisabled
|
||||
? (onDisabledPressed != null ? onDisabledPressed : null)
|
||||
: onPressed,
|
||||
color: isDisabled ? color.withOpacity(0.5) : color,
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
disabledColor: color.withOpacity(0.5),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(26.0),
|
||||
),
|
||||
// FIX-ME: Need to add style
|
||||
// color: isDisabled ? color.withOpacity(0.5) : color,
|
||||
//splashColor: Colors.transparent,
|
||||
//highlightColor: Colors.transparent,
|
||||
//disabledColor: color.withOpacity(0.5),
|
||||
//shape: RoundedRectangleBorder(
|
||||
// borderRadius: BorderRadius.circular(26.0),
|
||||
//),
|
||||
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color)),
|
||||
child: Text(text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
@@ -62,10 +64,10 @@ class PrimaryButton extends StatelessWidget {
|
||||
|
||||
class LoadingPrimaryButton extends StatelessWidget {
|
||||
const LoadingPrimaryButton(
|
||||
{@required this.onPressed,
|
||||
@required this.text,
|
||||
@required this.color,
|
||||
@required this.textColor,
|
||||
{required this.onPressed,
|
||||
required this.text,
|
||||
required this.color,
|
||||
required this.textColor,
|
||||
this.isDisabled = false,
|
||||
this.isLoading = false});
|
||||
|
||||
@@ -79,14 +81,16 @@ class LoadingPrimaryButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 52.0,
|
||||
child: FlatButton(
|
||||
// FIX-ME: styles
|
||||
//minWidth: double.infinity,
|
||||
//height: 52.0,
|
||||
child: TextButton(
|
||||
onPressed: (isLoading || isDisabled) ? null : onPressed,
|
||||
color: color,
|
||||
disabledColor: color.withOpacity(0.5),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(26.0)),
|
||||
//color: color,
|
||||
//disabledColor: color.withOpacity(0.5),
|
||||
//shape: RoundedRectangleBorder(
|
||||
//borderRadius: BorderRadius.circular(26.0)),
|
||||
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color)),
|
||||
child: isLoading
|
||||
? CupertinoActivityIndicator(animating: true)
|
||||
: Text(text,
|
||||
@@ -103,14 +107,14 @@ class LoadingPrimaryButton extends StatelessWidget {
|
||||
|
||||
class PrimaryIconButton extends StatelessWidget {
|
||||
const PrimaryIconButton({
|
||||
@required this.onPressed,
|
||||
@required this.iconData,
|
||||
@required this.text,
|
||||
@required this.color,
|
||||
@required this.borderColor,
|
||||
@required this.iconColor,
|
||||
@required this.iconBackgroundColor,
|
||||
@required this.textColor,
|
||||
required this.onPressed,
|
||||
required this.iconData,
|
||||
required this.text,
|
||||
required this.color,
|
||||
required this.borderColor,
|
||||
required this.iconColor,
|
||||
required this.iconBackgroundColor,
|
||||
required this.textColor,
|
||||
this.mainAxisAlignment = MainAxisAlignment.start,
|
||||
this.radius = 26
|
||||
});
|
||||
@@ -129,14 +133,15 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 52.0,
|
||||
child: FlatButton(
|
||||
// FIX-ME: styles
|
||||
//minWidth: double.infinity,
|
||||
//height: 52.0,
|
||||
child: TextButton(
|
||||
onPressed: onPressed,
|
||||
color: color,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(radius)),
|
||||
//color: color,
|
||||
//shape: RoundedRectangleBorder(
|
||||
// side: BorderSide(color: borderColor),
|
||||
// borderRadius: BorderRadius.circular(radius)),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
@@ -170,11 +175,11 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
|
||||
class PrimaryImageButton extends StatelessWidget {
|
||||
const PrimaryImageButton(
|
||||
{@required this.onPressed,
|
||||
@required this.image,
|
||||
@required this.text,
|
||||
@required this.color,
|
||||
@required this.textColor,
|
||||
{required this.onPressed,
|
||||
required this.image,
|
||||
required this.text,
|
||||
required this.color,
|
||||
required this.textColor,
|
||||
this.borderColor = Colors.transparent});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
@@ -189,12 +194,14 @@ class PrimaryImageButton extends StatelessWidget {
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 52.0,
|
||||
child: FlatButton(
|
||||
child: TextButton(
|
||||
onPressed: onPressed,
|
||||
color: color,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: borderColor),
|
||||
borderRadius: BorderRadius.circular(26.0)),
|
||||
// FIX-ME: Style
|
||||
//color: color,
|
||||
//shape: RoundedRectangleBorder(
|
||||
// side: BorderSide(color: borderColor),
|
||||
// borderRadius: BorderRadius.circular(26.0)),
|
||||
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(color)),
|
||||
child:Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -3,15 +3,15 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollableWithBottomSection extends StatefulWidget {
|
||||
ScrollableWithBottomSection(
|
||||
{this.content,
|
||||
this.bottomSection,
|
||||
{required this.content,
|
||||
required this.bottomSection,
|
||||
this.contentPadding,
|
||||
this.bottomSectionPadding});
|
||||
|
||||
final Widget content;
|
||||
final Widget bottomSection;
|
||||
final EdgeInsets contentPadding;
|
||||
final EdgeInsets bottomSectionPadding;
|
||||
final EdgeInsets? contentPadding;
|
||||
final EdgeInsets? bottomSectionPadding;
|
||||
|
||||
@override
|
||||
ScrollableWithBottomSectionState createState() =>
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'package:cake_wallet/src/screens/new_wallet/widgets/select_button.dart';
|
||||
import 'package:cake_wallet/src/screens/seed_language/widgets/seed_language_picker.dart';
|
||||
|
||||
class SeedLanguageSelector extends StatefulWidget {
|
||||
SeedLanguageSelector({Key key, this.initialSelected}) : super(key: key);
|
||||
SeedLanguageSelector({Key? key, required this.initialSelected}) : super(key: key);
|
||||
|
||||
final String initialSelected;
|
||||
|
||||
@@ -15,7 +15,7 @@ class SeedLanguageSelector extends StatefulWidget {
|
||||
}
|
||||
|
||||
class SeedLanguageSelectorState extends State<SeedLanguageSelector> {
|
||||
SeedLanguageSelectorState({this.selected});
|
||||
SeedLanguageSelectorState({required this.selected});
|
||||
|
||||
final seedLocales = [
|
||||
S.current.seed_language_english,
|
||||
|
||||
@@ -12,21 +12,27 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class SeedWidget extends StatefulWidget {
|
||||
SeedWidget({Key key, this.language, this.type, this.onSeedChange}) : super(key: key);
|
||||
SeedWidget({
|
||||
Key? key,
|
||||
required this.language,
|
||||
required this.type,
|
||||
this.onSeedChange}) : super(key: key);
|
||||
|
||||
final String language;
|
||||
final WalletType type;
|
||||
final void Function(String) onSeedChange;
|
||||
final void Function(String)? onSeedChange;
|
||||
|
||||
@override
|
||||
SeedWidgetState createState() => SeedWidgetState(language, type);
|
||||
}
|
||||
|
||||
class SeedWidgetState extends State<SeedWidget> {
|
||||
|
||||
SeedWidgetState(String language, this.type)
|
||||
: controller = TextEditingController(),
|
||||
focusNode = FocusNode(),
|
||||
words = SeedValidator.getWordList(type: type, language: language) {
|
||||
words = SeedValidator.getWordList(type: type, language: language),
|
||||
_showPlaceholder = false {
|
||||
focusNode.addListener(() {
|
||||
setState(() {
|
||||
if (!focusNode.hasFocus && controller.text.isEmpty) {
|
||||
@@ -83,7 +89,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
cursorColor: Colors.blue,
|
||||
backgroundCursorColor: Colors.blue,
|
||||
validStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
backgroundColor: Colors.transparent,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16),
|
||||
@@ -96,7 +102,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
controller: controller,
|
||||
words: words,
|
||||
textStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme.title.color,
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
backgroundColor: Colors.transparent,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16),
|
||||
@@ -117,15 +123,15 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
BorderRadius.all(Radius.circular(6))),
|
||||
child: Image.asset('assets/images/paste_ios.png',
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.display1
|
||||
.decorationColor)),
|
||||
.primaryTextTheme!
|
||||
.headline4!
|
||||
.decorationColor!)),
|
||||
)))
|
||||
]),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
height: 1.0,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor),
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!),
|
||||
]));
|
||||
}
|
||||
|
||||
@@ -135,7 +141,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
if (value?.text?.isNotEmpty ?? false) {
|
||||
setState(() {
|
||||
_showPlaceholder = false;
|
||||
controller.text = value.text;
|
||||
controller.text = value!.text!;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,11 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class StandardCheckbox extends StatefulWidget {
|
||||
StandardCheckbox({
|
||||
Key key,
|
||||
@required this.value,
|
||||
Key? key,
|
||||
required this.value,
|
||||
this.caption = '',
|
||||
@required this.onChanged}) : super(key: key);
|
||||
required this.onChanged})
|
||||
: super(key: key);
|
||||
|
||||
final bool value;
|
||||
final String caption;
|
||||
@@ -47,9 +48,9 @@ class StandardCheckboxState extends State<StandardCheckbox> {
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.caption
|
||||
.color,
|
||||
.primaryTextTheme!
|
||||
.caption!
|
||||
.color!,
|
||||
width: 1.0),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(8.0)),
|
||||
@@ -69,9 +70,9 @@ class StandardCheckboxState extends State<StandardCheckbox> {
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color),
|
||||
.primaryTextTheme!
|
||||
.headline6!
|
||||
.color!),
|
||||
)
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/standart_list_card.dart';
|
||||
import 'package:cake_wallet/src/widgets/standart_list_status_row.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandardListRow extends StatelessWidget {
|
||||
StandardListRow(
|
||||
{@required this.title, @required this.isSelected, this.onTap});
|
||||
{required this.title, required this.isSelected, this.onTap});
|
||||
|
||||
final String title;
|
||||
final bool isSelected;
|
||||
final void Function(BuildContext context) onTap;
|
||||
final void Function(BuildContext context)? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -32,9 +31,9 @@ class StandardListRow extends StatelessWidget {
|
||||
])));
|
||||
}
|
||||
|
||||
Widget buildLeading(BuildContext context) => null;
|
||||
Widget? buildLeading(BuildContext context) => null;
|
||||
|
||||
Widget buildCenter(BuildContext context, {@required bool hasLeftOffset}) {
|
||||
Widget buildCenter(BuildContext context, {required bool hasLeftOffset}) {
|
||||
// FIXME: find better way for keep text on left side.
|
||||
return Expanded(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
@@ -51,11 +50,11 @@ class StandardListRow extends StatelessWidget {
|
||||
]));
|
||||
}
|
||||
|
||||
Widget buildTrailing(BuildContext context) => null;
|
||||
Widget? buildTrailing(BuildContext context) => null;
|
||||
|
||||
Color titleColor(BuildContext context) => isSelected
|
||||
? Palette.blueCraiola
|
||||
: Theme.of(context).primaryTextTheme.title.color;
|
||||
: Theme.of(context).primaryTextTheme!.headline6!.color!;
|
||||
|
||||
Color _backgroundColor(BuildContext context) {
|
||||
return Theme.of(context).backgroundColor;
|
||||
@@ -76,13 +75,11 @@ class SectionHeaderListRow extends StatelessWidget {
|
||||
|
||||
class StandardListSeparator extends StatelessWidget {
|
||||
|
||||
StandardListSeparator({this.padding,this.height=1});
|
||||
StandardListSeparator({this.padding, this.height = 1});
|
||||
|
||||
final EdgeInsets padding;
|
||||
final EdgeInsets? padding;
|
||||
final double height;
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -91,12 +88,13 @@ class StandardListSeparator extends StatelessWidget {
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Container(
|
||||
height: height,
|
||||
color: Theme.of(context).primaryTextTheme.title.backgroundColor));
|
||||
// color: Theme.of(context).primaryTextTheme!.headline6!.backgroundColor!
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class StandardList extends StatelessWidget {
|
||||
StandardList({@required this.itemCount, @required this.itemBuilder});
|
||||
StandardList({required this.itemCount, required this.itemBuilder});
|
||||
|
||||
final int itemCount;
|
||||
final IndexedWidgetBuilder itemBuilder;
|
||||
@@ -113,7 +111,7 @@ class StandardList extends StatelessWidget {
|
||||
}
|
||||
|
||||
class SectionStandardListItem {
|
||||
SectionStandardListItem({this.hasFullSeparator = false, this.child});
|
||||
SectionStandardListItem({this.hasFullSeparator = false, required this.child});
|
||||
|
||||
final bool hasFullSeparator;
|
||||
final Widget child;
|
||||
@@ -121,14 +119,14 @@ class SectionStandardListItem {
|
||||
|
||||
class SectionStandardList extends StatelessWidget {
|
||||
SectionStandardList(
|
||||
{@required this.itemCounter,
|
||||
@required this.itemBuilder,
|
||||
@required this.sectionCount,
|
||||
this.sectionTitleBuilder,
|
||||
this.hasTopSeparator = false,
|
||||
{required this.itemCounter,
|
||||
required this.itemBuilder,
|
||||
required this.sectionCount,
|
||||
required BuildContext context,
|
||||
this.themeColor,
|
||||
this.dividerThemeColor,
|
||||
BuildContext context})
|
||||
this.sectionTitleBuilder,
|
||||
this.hasTopSeparator = false,})
|
||||
: totalRows = [] {
|
||||
totalRows.addAll(transform(
|
||||
hasTopSeparator,
|
||||
@@ -146,11 +144,11 @@ class SectionStandardList extends StatelessWidget {
|
||||
final int Function(int sectionIndex) itemCounter;
|
||||
final Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder;
|
||||
final Widget Function(BuildContext context, int sectionIndex)
|
||||
final Widget Function(BuildContext context, int sectionIndex)?
|
||||
sectionTitleBuilder;
|
||||
final List<Widget> totalRows;
|
||||
final Color themeColor;
|
||||
final Color dividerThemeColor;
|
||||
final Color? themeColor;
|
||||
final Color? dividerThemeColor;
|
||||
|
||||
List<Widget> transform(
|
||||
bool hasTopSeparator,
|
||||
@@ -159,10 +157,10 @@ class SectionStandardList extends StatelessWidget {
|
||||
int Function(int sectionIndex) itemCounter,
|
||||
Widget Function(BuildContext context, int sectionIndex, int itemIndex)
|
||||
itemBuilder,
|
||||
Widget Function(BuildContext context, int sectionIndex)
|
||||
Widget Function(BuildContext context, int sectionIndex)?
|
||||
sectionTitleBuilder,
|
||||
Color themeColor,
|
||||
Color dividerThemeColor) {
|
||||
Color? themeColor,
|
||||
Color? dividerThemeColor) {
|
||||
final items = <Widget>[];
|
||||
|
||||
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
||||
@@ -188,8 +186,11 @@ class SectionStandardList extends StatelessWidget {
|
||||
|
||||
Widget buildTitle(
|
||||
List<Widget> items, int sectionIndex, BuildContext context) {
|
||||
final title = sectionTitleBuilder(context, sectionIndex);
|
||||
return title;
|
||||
if (sectionTitleBuilder == null) {
|
||||
throw Exception('Cannot to build title. sectionTitleBuilder is null');
|
||||
}
|
||||
|
||||
return sectionTitleBuilder!.call(context, sectionIndex);
|
||||
}
|
||||
|
||||
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex,
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
|
||||
class TradeDatailsStandartListCard extends StatelessWidget {
|
||||
TradeDatailsStandartListCard(
|
||||
{this.id, this.create, this.pair, this.onTap, this.currentTheme});
|
||||
{required this.id,
|
||||
required this.create,
|
||||
required this.pair,
|
||||
required this.onTap,
|
||||
required this.currentTheme});
|
||||
|
||||
final String id;
|
||||
final String create;
|
||||
@@ -18,8 +21,8 @@ class TradeDatailsStandartListCard extends StatelessWidget {
|
||||
final darkTheme = currentTheme == ThemeType.dark;
|
||||
|
||||
final baseGradient = LinearGradient(colors: [
|
||||
Theme.of(context).primaryTextTheme.subtitle.color,
|
||||
Theme.of(context).primaryTextTheme.subtitle.decorationColor,
|
||||
Theme.of(context).primaryTextTheme!.subtitle2!.color!,
|
||||
Theme.of(context).primaryTextTheme!.subtitle2!.decorationColor!,
|
||||
], begin: Alignment.centerLeft, end: Alignment.centerRight);
|
||||
|
||||
final gradient = LinearGradient(colors: [
|
||||
|
||||
@@ -3,8 +3,8 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class StandartListRow extends StatelessWidget {
|
||||
StandartListRow(
|
||||
{this.title,
|
||||
this.value,
|
||||
{required this.title,
|
||||
required this.value,
|
||||
this.titleFontSize = 14,
|
||||
this.valueFontSize = 16,
|
||||
this.image});
|
||||
@@ -13,7 +13,7 @@ class StandartListRow extends StatelessWidget {
|
||||
final String value;
|
||||
final double titleFontSize;
|
||||
final double valueFontSize;
|
||||
final Image image;
|
||||
final Image? image;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -31,7 +31,7 @@ class StandartListRow extends StatelessWidget {
|
||||
fontSize: titleFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.overline.color),
|
||||
Theme.of(context).primaryTextTheme!.overline!.color!),
|
||||
textAlign: TextAlign.left),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
@@ -46,9 +46,9 @@ class StandartListRow extends StatelessWidget {
|
||||
fontSize: valueFontSize,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color)),
|
||||
.primaryTextTheme!
|
||||
.headline6!
|
||||
.color!)),
|
||||
),
|
||||
image != null
|
||||
? Padding(
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandartListStatusRow extends StatelessWidget {
|
||||
StandartListStatusRow({this.title, this.value});
|
||||
StandartListStatusRow({required this.title, required this.value});
|
||||
|
||||
final String title;
|
||||
final String value;
|
||||
@@ -24,13 +24,13 @@ class StandartListStatusRow extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).primaryTextTheme.overline.color),
|
||||
color: Theme.of(context).primaryTextTheme!.overline!.color!),
|
||||
textAlign: TextAlign.left),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).accentTextTheme.display2.color,
|
||||
color: Theme.of(context).accentTextTheme!.headline3!.color!,
|
||||
borderRadius: BorderRadius.circular(30.0),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -51,9 +51,9 @@ class StandartListStatusRow extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.title
|
||||
.color))
|
||||
.primaryTextTheme!
|
||||
.headline6!
|
||||
.color!))
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandartSwitch extends StatefulWidget {
|
||||
const StandartSwitch({@required this.value, @required this.onTaped});
|
||||
const StandartSwitch({required this.value, required this.onTaped});
|
||||
|
||||
final bool value;
|
||||
final VoidCallback onTaped;
|
||||
@@ -24,8 +24,8 @@ class StandartSwitchState extends State<StandartSwitch> {
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: widget.value
|
||||
? Theme.of(context).accentTextTheme.body2.color
|
||||
: Theme.of(context).accentTextTheme.display4.color,
|
||||
? Theme.of(context).accentTextTheme!.bodyText1!.color!
|
||||
: Theme.of(context).accentTextTheme!.headline1!.color!,
|
||||
borderRadius: BorderRadius.all(Radius.circular(14.0))),
|
||||
child: Container(
|
||||
width: 24.0,
|
||||
|
||||
@@ -3,12 +3,12 @@ import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class TemplateTile extends StatefulWidget {
|
||||
TemplateTile({
|
||||
Key key,
|
||||
@required this.to,
|
||||
@required this.amount,
|
||||
@required this.from,
|
||||
@required this.onTap,
|
||||
@required this.onRemove
|
||||
Key? key,
|
||||
required this.to,
|
||||
required this.amount,
|
||||
required this.from,
|
||||
required this.onTap,
|
||||
required this.onRemove
|
||||
}) : super(key: key);
|
||||
|
||||
final String to;
|
||||
@@ -47,7 +47,7 @@ class TemplateTileState extends State<TemplateTile> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = isRemovable ? Colors.white : Theme.of(context).primaryTextTheme.title.color;
|
||||
final color = isRemovable ? Colors.white : Theme.of(context).primaryTextTheme!.headline6!.color!;
|
||||
final toIcon = Image.asset('assets/images/to_icon.png', color: color);
|
||||
|
||||
final content = Row(
|
||||
@@ -105,7 +105,7 @@ class TemplateTileState extends State<TemplateTile> {
|
||||
child: Container(
|
||||
height: 40,
|
||||
padding: EdgeInsets.only(left: 24, right: 24),
|
||||
color: Theme.of(context).primaryTextTheme.display3.decorationColor,
|
||||
color: Theme.of(context).primaryTextTheme!.headline2!.decorationColor!,
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2,11 +2,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class TrailButton extends StatelessWidget {
|
||||
TrailButton({@required this.caption, this.textColor, @required this.onPressed});
|
||||
TrailButton({
|
||||
required this.caption,
|
||||
required this.onPressed,
|
||||
this.textColor});
|
||||
|
||||
final String caption;
|
||||
final VoidCallback onPressed;
|
||||
final Color textColor;
|
||||
final Color? textColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -14,13 +17,14 @@ class TrailButton extends StatelessWidget {
|
||||
minWidth: double.minPositive,
|
||||
highlightColor: Colors.transparent,
|
||||
splashColor: Colors.transparent,
|
||||
child: FlatButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: TextButton(
|
||||
// FIX-ME: ignored padding
|
||||
//padding: EdgeInsets.all(0),
|
||||
child: Text(
|
||||
caption,
|
||||
style: TextStyle(
|
||||
color: textColor ??
|
||||
Theme.of(context).accentTextTheme.display4.decorationColor,
|
||||
Theme.of(context).accentTextTheme!.headline1!.decorationColor!,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14),
|
||||
),
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Annotation extends Comparable<Annotation> {
|
||||
Annotation({@required this.range, this.style});
|
||||
Annotation({required this.range, required this.style});
|
||||
|
||||
final TextRange range;
|
||||
final TextStyle style;
|
||||
@@ -13,7 +13,7 @@ class Annotation extends Comparable<Annotation> {
|
||||
}
|
||||
|
||||
class TextAnnotation extends Comparable<TextAnnotation> {
|
||||
TextAnnotation({@required this.text, this.style});
|
||||
TextAnnotation({required this.text, required this.style});
|
||||
|
||||
final TextStyle style;
|
||||
final String text;
|
||||
@@ -24,24 +24,24 @@ class TextAnnotation extends Comparable<TextAnnotation> {
|
||||
|
||||
class ValidatableAnnotatedEditableText extends EditableText {
|
||||
ValidatableAnnotatedEditableText({
|
||||
Key key,
|
||||
FocusNode focusNode,
|
||||
TextEditingController controller,
|
||||
List<String> wordList,
|
||||
ValueChanged<String> onChanged,
|
||||
ValueChanged<String> onSubmitted,
|
||||
Color cursorColor,
|
||||
Color selectionColor,
|
||||
Color backgroundCursorColor,
|
||||
TextSelectionControls selectionControls,
|
||||
this.validStyle,
|
||||
this.invalidStyle,
|
||||
Key? key,
|
||||
required FocusNode focusNode,
|
||||
required TextEditingController controller,
|
||||
// required List<String> wordList,
|
||||
required Color cursorColor,
|
||||
required Color backgroundCursorColor,
|
||||
required this.validStyle,
|
||||
required this.invalidStyle,
|
||||
required this.words,
|
||||
TextStyle textStyle = const TextStyle(
|
||||
color: Colors.black,
|
||||
backgroundColor: Colors.transparent,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 16),
|
||||
@required this.words,
|
||||
TextSelectionControls? selectionControls,
|
||||
Color? selectionColor,
|
||||
ValueChanged<String>? onChanged,
|
||||
ValueChanged<String>? onSubmitted,
|
||||
}) : super(
|
||||
maxLines: null,
|
||||
key: key,
|
||||
@@ -83,7 +83,7 @@ class ValidatableAnnotatedEditableTextState extends EditableTextState {
|
||||
super.widget as ValidatableAnnotatedEditableText;
|
||||
|
||||
List<Annotation> getRanges() {
|
||||
final result = List<Annotation>();
|
||||
final result = <Annotation>[];
|
||||
final text = textEditingValue.text;
|
||||
final source = text
|
||||
.split(' ')
|
||||
@@ -98,10 +98,10 @@ class ValidatableAnnotatedEditableTextState extends EditableTextState {
|
||||
.expand((e) => e)
|
||||
.toList();
|
||||
source.sort();
|
||||
Annotation prev;
|
||||
Annotation? prev;
|
||||
|
||||
for (var item in source) {
|
||||
Annotation annotation;
|
||||
Annotation? annotation;
|
||||
|
||||
if (prev == null) {
|
||||
annotation = Annotation(
|
||||
@@ -134,7 +134,7 @@ class ValidatableAnnotatedEditableTextState extends EditableTextState {
|
||||
bool validate(String source) => widget.words.indexOf(source) >= 0;
|
||||
|
||||
List<TextRange> range(String pattern, String source) {
|
||||
final result = List<TextRange>();
|
||||
final result = <TextRange>[];
|
||||
|
||||
if (pattern.isEmpty || source.isEmpty) {
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user