mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-19 10:04:17 +01:00
Fixed issues for linter and analyzer
This commit is contained in:
@@ -9,17 +9,6 @@ import 'package:cake_wallet/src/domain/common/qr_scanner.dart';
|
||||
enum AddressTextFieldOption { qrCode, addressBook, subaddressList }
|
||||
|
||||
class AddressTextField extends StatelessWidget {
|
||||
static const prefixIconWidth = 34.0;
|
||||
static const prefixIconHeight = 34.0;
|
||||
static const spaceBetweenPrefixIcons = 10.0;
|
||||
|
||||
final TextEditingController controller;
|
||||
final bool isActive;
|
||||
final String placeholder;
|
||||
final Function(Uri) onURIScanned;
|
||||
final List<AddressTextFieldOption> options;
|
||||
final FormFieldValidator<String> validator;
|
||||
|
||||
AddressTextField(
|
||||
{@required this.controller,
|
||||
this.isActive = true,
|
||||
@@ -31,6 +20,17 @@ class AddressTextField extends StatelessWidget {
|
||||
this.onURIScanned,
|
||||
this.validator});
|
||||
|
||||
static const prefixIconWidth = 34.0;
|
||||
static const prefixIconHeight = 34.0;
|
||||
static const spaceBetweenPrefixIcons = 10.0;
|
||||
|
||||
final TextEditingController controller;
|
||||
final bool isActive;
|
||||
final String placeholder;
|
||||
final Function(Uri) onURIScanned;
|
||||
final List<AddressTextFieldOption> options;
|
||||
final FormFieldValidator<String> validator;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
@@ -105,8 +105,7 @@ class AddressTextField extends StatelessWidget {
|
||||
hintStyle: TextStyle(color: Theme.of(context).hintColor),
|
||||
hintText: placeholder ?? S.current.widgets_address,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Palette.cakeGreen, width: 2.0)),
|
||||
borderSide: BorderSide(color: Palette.cakeGreen, width: 2.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Theme.of(context).focusColor, width: 1.0)),
|
||||
@@ -115,10 +114,10 @@ class AddressTextField extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future _presentQRScanner(BuildContext context) async {
|
||||
Future<void> _presentQRScanner(BuildContext context) async {
|
||||
try {
|
||||
String code = await presentQRScanner();
|
||||
var uri = Uri.parse(code);
|
||||
final code = await presentQRScanner();
|
||||
final uri = Uri.parse(code);
|
||||
var address = '';
|
||||
|
||||
if (uri == null) {
|
||||
@@ -137,7 +136,7 @@ class AddressTextField extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future _presetAddressBookPicker(BuildContext context) async {
|
||||
Future<void> _presetAddressBookPicker(BuildContext context) async {
|
||||
final contact = await Navigator.of(context, rootNavigator: true)
|
||||
.pushNamed(Routes.pickerAddressBook);
|
||||
|
||||
@@ -146,7 +145,7 @@ class AddressTextField extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Future _presetSubaddressListPicker(BuildContext context) async {
|
||||
Future<void> _presetSubaddressListPicker(BuildContext context) async {
|
||||
final subaddress = await Navigator.of(context, rootNavigator: true)
|
||||
.pushNamed(Routes.subaddressList);
|
||||
|
||||
|
||||
@@ -5,8 +5,23 @@ import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
static const _originalHeight = 44.0; // iOS nav bar height
|
||||
static const _height = 60.0;
|
||||
factory NavBar(
|
||||
{BuildContext context,
|
||||
Widget leading,
|
||||
Widget middle,
|
||||
Widget trailing,
|
||||
Color backgroundColor}) {
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
|
||||
|
||||
return NavBar._internal(
|
||||
leading: leading,
|
||||
middle: middle,
|
||||
trailing: trailing,
|
||||
height: _height,
|
||||
backgroundColor:
|
||||
_isDarkTheme ? Theme.of(context).backgroundColor : backgroundColor);
|
||||
}
|
||||
|
||||
factory NavBar.withShadow(
|
||||
{BuildContext context,
|
||||
@@ -37,31 +52,6 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
);
|
||||
}
|
||||
|
||||
factory NavBar(
|
||||
{BuildContext context,
|
||||
Widget leading,
|
||||
Widget middle,
|
||||
Widget trailing,
|
||||
Color backgroundColor}) {
|
||||
final _themeChanger = Provider.of<ThemeChanger>(context);
|
||||
final _isDarkTheme = _themeChanger.getTheme() == Themes.darkTheme;
|
||||
|
||||
return NavBar._internal(
|
||||
leading: leading,
|
||||
middle: middle,
|
||||
trailing: trailing,
|
||||
height: _height,
|
||||
backgroundColor:
|
||||
_isDarkTheme ? Theme.of(context).backgroundColor : backgroundColor);
|
||||
}
|
||||
|
||||
final Widget leading;
|
||||
final Widget middle;
|
||||
final Widget trailing;
|
||||
final Color backgroundColor;
|
||||
final BoxDecoration decoration;
|
||||
final double height;
|
||||
|
||||
NavBar._internal(
|
||||
{this.leading,
|
||||
this.middle,
|
||||
@@ -70,6 +60,16 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget {
|
||||
this.decoration,
|
||||
this.height = _height});
|
||||
|
||||
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 double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pad = height - _originalHeight;
|
||||
|
||||
+14
-10
@@ -2,12 +2,6 @@ import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Picker<Item extends Object> extends StatelessWidget {
|
||||
final int selectedAtIndex;
|
||||
final List<Item> items;
|
||||
final String title;
|
||||
final double pickerHeight;
|
||||
final Function(Item) onItemSelected;
|
||||
|
||||
Picker(
|
||||
{@required this.selectedAtIndex,
|
||||
@required this.items,
|
||||
@@ -15,9 +9,14 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
this.pickerHeight = 300,
|
||||
this.onItemSelected});
|
||||
|
||||
final int selectedAtIndex;
|
||||
final List<Item> items;
|
||||
final String title;
|
||||
final double pickerHeight;
|
||||
final Function(Item) onItemSelected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: Container(
|
||||
@@ -57,8 +56,10 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
fontWeight: FontWeight.w600,
|
||||
fontFamily: 'Lato',
|
||||
decoration: TextDecoration.none,
|
||||
color: Theme.of(context).primaryTextTheme.caption.color
|
||||
),
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.caption
|
||||
.color),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -88,7 +89,10 @@ class Picker<Item extends Object> extends StatelessWidget {
|
||||
fontFamily: 'Lato',
|
||||
color: index == selectedAtIndex
|
||||
? Color.fromRGBO(138, 80, 255, 1)
|
||||
: Theme.of(context).primaryTextTheme.caption.color),
|
||||
: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.caption
|
||||
.color),
|
||||
)),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -3,20 +3,19 @@ import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final String text;
|
||||
|
||||
const PrimaryButton(
|
||||
{@required this.onPressed,
|
||||
@required this.text,
|
||||
@required this.color,
|
||||
@required this.borderColor});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 56.0,
|
||||
@@ -35,13 +34,6 @@ class PrimaryButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
class LoadingPrimaryButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final bool isLoading;
|
||||
final bool isDisabled;
|
||||
final String text;
|
||||
|
||||
const LoadingPrimaryButton(
|
||||
{@required this.onPressed,
|
||||
@required this.text,
|
||||
@@ -50,9 +42,15 @@ class LoadingPrimaryButton extends StatelessWidget {
|
||||
this.isDisabled = false,
|
||||
this.isLoading = false});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final bool isLoading;
|
||||
final bool isDisabled;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 56.0,
|
||||
@@ -73,14 +71,6 @@ class LoadingPrimaryButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
class PrimaryIconButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final IconData iconData;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final Color iconColor;
|
||||
final Color iconBackgroundColor;
|
||||
final String text;
|
||||
|
||||
const PrimaryIconButton({
|
||||
@required this.onPressed,
|
||||
@required this.iconData,
|
||||
@@ -91,9 +81,16 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
@required this.iconBackgroundColor,
|
||||
});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final IconData iconData;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final Color iconColor;
|
||||
final Color iconBackgroundColor;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return ButtonTheme(
|
||||
minWidth: double.infinity,
|
||||
height: 56.0,
|
||||
@@ -123,7 +120,8 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 16.0,
|
||||
color: Theme.of(context).primaryTextTheme.button.color)),
|
||||
color:
|
||||
Theme.of(context).primaryTextTheme.button.color)),
|
||||
),
|
||||
)
|
||||
],
|
||||
@@ -133,13 +131,6 @@ class PrimaryIconButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
class PrimaryImageButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final Image image;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final Color iconColor;
|
||||
final String text;
|
||||
|
||||
const PrimaryImageButton(
|
||||
{@required this.onPressed,
|
||||
@required this.image,
|
||||
@@ -148,6 +139,13 @@ class PrimaryImageButton extends StatelessWidget {
|
||||
this.borderColor = Palette.deepPink,
|
||||
this.iconColor = Colors.black});
|
||||
|
||||
final VoidCallback onPressed;
|
||||
final Image image;
|
||||
final Color color;
|
||||
final Color borderColor;
|
||||
final Color iconColor;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ButtonTheme(
|
||||
@@ -175,9 +173,13 @@ class PrimaryImageButton extends StatelessWidget {
|
||||
Container(
|
||||
height: 56.0,
|
||||
child: Center(
|
||||
child: Text(text, style: TextStyle(fontSize: 18.0,
|
||||
color: Theme.of(context).primaryTextTheme.button.color
|
||||
)),
|
||||
child: Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 18.0,
|
||||
color: Theme.of(context)
|
||||
.primaryTextTheme
|
||||
.button
|
||||
.color)),
|
||||
),
|
||||
)
|
||||
]))
|
||||
|
||||
@@ -2,17 +2,17 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollableWithBottomSection extends StatefulWidget {
|
||||
final Widget content;
|
||||
final Widget bottomSection;
|
||||
final EdgeInsets contentPadding;
|
||||
final EdgeInsets bottomSectionPadding;
|
||||
|
||||
ScrollableWithBottomSection(
|
||||
{this.content,
|
||||
this.bottomSection,
|
||||
this.contentPadding,
|
||||
this.bottomSectionPadding});
|
||||
|
||||
final Widget content;
|
||||
final Widget bottomSection;
|
||||
final EdgeInsets contentPadding;
|
||||
final EdgeInsets bottomSectionPadding;
|
||||
|
||||
@override
|
||||
ScrollableWithBottomSectionState createState() =>
|
||||
ScrollableWithBottomSectionState();
|
||||
|
||||
@@ -7,10 +7,11 @@ import 'package:cake_wallet/src/domain/common/mnemotic_item.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
|
||||
class SeedWidget extends StatefulWidget {
|
||||
final Function(List<MnemoticItem>) onMnemoticChange;
|
||||
|
||||
SeedWidget({Key key, this.onMnemoticChange}) : super(key: key);
|
||||
|
||||
final Function(List<MnemoticItem>) onMnemoticChange;
|
||||
|
||||
@override
|
||||
SeedWidgetState createState() => SeedWidgetState();
|
||||
}
|
||||
|
||||
@@ -188,8 +189,7 @@ class SeedWidgetState extends State<SeedWidget> {
|
||||
hintStyle: TextStyle(color: Theme.of(context).hintColor),
|
||||
hintText: S.of(context).widgets_seed,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Palette.cakeGreen, width: 2.0)),
|
||||
borderSide: BorderSide(color: Palette.cakeGreen, width: 2.0)),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color:
|
||||
|
||||
@@ -1,41 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class StandartSwitch extends StatefulWidget {
|
||||
const StandartSwitch({@required this.value, @required this.onTaped});
|
||||
|
||||
final bool value;
|
||||
final VoidCallback onTaped;
|
||||
|
||||
const StandartSwitch({
|
||||
@required this.value,
|
||||
@required this.onTaped});
|
||||
|
||||
@override
|
||||
createState() => StandartSwitchState();
|
||||
|
||||
StandartSwitchState createState() => StandartSwitchState();
|
||||
}
|
||||
|
||||
class StandartSwitchState extends State<StandartSwitch> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return GestureDetector(
|
||||
onTap: widget.onTaped,
|
||||
child: AnimatedContainer(
|
||||
padding: EdgeInsets.only(left: 4.0, right: 4.0),
|
||||
alignment: widget.value
|
||||
? Alignment.centerRight
|
||||
: Alignment.centerLeft,
|
||||
alignment: widget.value ? Alignment.centerRight : Alignment.centerLeft,
|
||||
duration: Duration(milliseconds: 250),
|
||||
width: 55.0,
|
||||
height: 33.0,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).toggleButtonsTheme.color,
|
||||
border: Border.all(
|
||||
color: Theme.of(context).toggleButtonsTheme.borderColor
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(10.0))),
|
||||
color: Theme.of(context).toggleButtonsTheme.borderColor),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0))),
|
||||
child: Container(
|
||||
width: 25.0,
|
||||
height: 25.0,
|
||||
@@ -43,11 +33,9 @@ class StandartSwitchState extends State<StandartSwitch> {
|
||||
color: widget.value
|
||||
? Theme.of(context).toggleButtonsTheme.selectedColor
|
||||
: Theme.of(context).toggleButtonsTheme.disabledColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(8.0))),
|
||||
child: Icon(widget.value
|
||||
? Icons.check
|
||||
: Icons.close,
|
||||
borderRadius: BorderRadius.all(Radius.circular(8.0))),
|
||||
child: Icon(
|
||||
widget.value ? Icons.check : Icons.close,
|
||||
color: Colors.white,
|
||||
size: 16.0,
|
||||
),
|
||||
@@ -55,5 +43,4 @@ class StandartSwitchState extends State<StandartSwitch> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user