mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
* [skip-ci] wip * [skip-ci] styles still need updating * working but needs style updates * fix checkbox caption color * sort mweb coins to be last when selecting inputs * ui fixes * [skip-ci] default to mweb-checkbox being off * adaptable page view builder + workaround for keyboard actions * Fix checkbox themeing and send card sizing * Update lib/src/screens/send/widgets/send_card.dart --------- Co-authored-by: tuxpizza <tuxsudo@tux.pizza> Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
84 lines
2.7 KiB
Dart
84 lines
2.7 KiB
Dart
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
|
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class StandardCheckbox extends StatelessWidget {
|
|
StandardCheckbox(
|
|
{required this.value,
|
|
this.caption = '',
|
|
this.gradientBackground = false,
|
|
this.borderColor,
|
|
this.iconColor,
|
|
this.captionColor,
|
|
required this.onChanged});
|
|
|
|
final bool value;
|
|
final String caption;
|
|
final bool gradientBackground;
|
|
final Color? borderColor;
|
|
final Color? iconColor;
|
|
final Color? captionColor;
|
|
final Function(bool) onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final baseGradient = LinearGradient(colors: [
|
|
Theme.of(context).extension<FilterTheme>()!.checkboxFirstGradientColor,
|
|
Theme.of(context).extension<FilterTheme>()!.checkboxSecondGradientColor,
|
|
], begin: Alignment.centerLeft, end: Alignment.centerRight);
|
|
|
|
final boxBorder = Border.all(
|
|
color: borderColor ?? Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor,
|
|
width: 1.0,
|
|
);
|
|
|
|
final checkedBoxDecoration = BoxDecoration(
|
|
gradient: gradientBackground ? baseGradient : null,
|
|
border: gradientBackground ? null : boxBorder,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)));
|
|
|
|
final uncheckedBoxDecoration =
|
|
BoxDecoration(border: boxBorder, borderRadius: BorderRadius.all(Radius.circular(8.0)));
|
|
|
|
return GestureDetector(
|
|
onTap: () => onChanged(!value),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
height: 24.0,
|
|
width: 24.0,
|
|
decoration: value ? checkedBoxDecoration : uncheckedBoxDecoration,
|
|
child: value
|
|
? Icon(
|
|
Icons.check,
|
|
color: iconColor ?? Theme.of(context).primaryColor,
|
|
size: 20.0,
|
|
)
|
|
: Offstage(),
|
|
),
|
|
if (caption.isNotEmpty)
|
|
Flexible(
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 10),
|
|
child: Text(
|
|
caption,
|
|
softWrap: true,
|
|
style: TextStyle(
|
|
fontSize: 16.0,
|
|
fontFamily: 'Lato',
|
|
fontWeight: FontWeight.normal,
|
|
color: captionColor ?? Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|