ui: extract RoundedIconButton

Serhii committed Jul 22, 2025 at 11:46 UTC 37e9d2c6e362f19a8a106375acad499733fefb7b
3 files changed +40 -75
lib/src/widgets/bottom_sheet/cake_pay_transaction_sent_bottom_sheet.dart
+1 -38
@@ -1,5 +1,6 @@
1 import 'package:cake_wallet/generated/i18n.dart';
2 import 'package:cake_wallet/src/widgets/primary_button.dart';
3 +import 'package:cake_wallet/src/widgets/rounded_icon_button.dart';
4 import 'package:cake_wallet/utils/image_utill.dart';
5 import 'package:cake_wallet/view_model/send/output.dart';
6 import 'package:cw_core/crypto_currency.dart';
@@ -312,41 +313,3 @@ class _StandardTile extends StatelessWidget {
313 );
314 }
315 }
315 -
316 -class RoundedIconButton extends StatelessWidget {
317 - const RoundedIconButton({this.icon,
318 - this.iconWidget,
319 - required this.onPressed,
320 - this.shape,
321 - this.width,
322 - this.height,
323 - this.iconSize,
324 - this.fillColor});
325 -
326 - final IconData? icon;
327 - final Widget? iconWidget;
328 - final VoidCallback onPressed;
329 - final ShapeBorder? shape;
330 - final double? width;
331 - final double? height;
332 - final double? iconSize;
333 - final Color? fillColor;
334 -
335 - @override
336 - Widget build(BuildContext context) {
337 - final colorScheme = Theme
338 - .of(context)
339 - .colorScheme;
340 - return RawMaterialButton(
341 - onPressed: onPressed,
342 - fillColor: fillColor ?? colorScheme.surfaceContainerHighest,
343 - elevation: 0,
344 - constraints: BoxConstraints.tightFor(width: width ?? 30, height: height ?? 30),
345 - padding: EdgeInsets.zero,
346 - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
347 - shape: shape ?? const CircleBorder(),
348 - child: icon != null
349 - ? Icon(icon, size: iconSize ?? 14, color: colorScheme.onSurface)
350 - : iconWidget);
351 - }
352 -}
lib/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart
+1 -37
@@ -1,4 +1,5 @@
1 import 'package:cake_wallet/generated/i18n.dart';
2 +import 'package:cake_wallet/src/widgets/rounded_icon_button.dart';
3 import 'package:cake_wallet/src/widgets/standard_slide_button_widget.dart';
4 import 'package:cake_wallet/themes/core/material_base_theme.dart';
5 import 'package:cake_wallet/themes/utils/custom_theme_colors.dart';
@@ -508,40 +509,3 @@ class ExpansionAddressTile extends StatelessWidget {
509 );
510 }
511 }
511 -
512 -class RoundedIconButton extends StatelessWidget {
513 - const RoundedIconButton(
514 - {this.icon,
515 - this.iconWidget,
516 - required this.onPressed,
517 - this.shape,
518 - this.width,
519 - this.height,
520 - this.iconSize,
521 - this.fillColor});
522 -
523 - final IconData? icon;
524 - final Widget? iconWidget;
525 - final VoidCallback onPressed;
526 - final ShapeBorder? shape;
527 - final double? width;
528 - final double? height;
529 - final double? iconSize;
530 - final Color? fillColor;
531 -
532 - @override
533 - Widget build(BuildContext context) {
534 - final colorScheme = Theme.of(context).colorScheme;
535 - return RawMaterialButton(
536 - onPressed: onPressed,
537 - fillColor: fillColor ?? colorScheme.surfaceContainerHighest,
538 - elevation: 0,
539 - constraints: BoxConstraints.tightFor(width: width ?? 30, height: height ?? 30),
540 - padding: EdgeInsets.zero,
541 - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
542 - shape: shape ?? const CircleBorder(),
543 - child: icon != null
544 - ? Icon(icon, size: iconSize ?? 14, color: colorScheme.onSurface)
545 - : iconWidget);
546 - }
547 -}
lib/src/widgets/rounded_icon_button.dart new
+38
@@ -0,0 +1,38 @@
1 +import 'package:flutter/material.dart';
2 +
3 +class RoundedIconButton extends StatelessWidget {
4 + const RoundedIconButton(
5 + {this.icon,
6 + this.iconWidget,
7 + required this.onPressed,
8 + this.shape,
9 + this.width,
10 + this.height,
11 + this.iconSize,
12 + this.fillColor});
13 +
14 + final IconData? icon;
15 + final Widget? iconWidget;
16 + final VoidCallback onPressed;
17 + final ShapeBorder? shape;
18 + final double? width;
19 + final double? height;
20 + final double? iconSize;
21 + final Color? fillColor;
22 +
23 + @override
24 + Widget build(BuildContext context) {
25 + final colorScheme = Theme.of(context).colorScheme;
26 + return RawMaterialButton(
27 + onPressed: onPressed,
28 + fillColor: fillColor ?? colorScheme.surfaceContainerHighest,
29 + elevation: 0,
30 + constraints: BoxConstraints.tightFor(width: width ?? 30, height: height ?? 30),
31 + padding: EdgeInsets.zero,
32 + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
33 + shape: shape ?? const CircleBorder(),
34 + child: icon != null
35 + ? Icon(icon, size: iconSize ?? 14, color: colorScheme.onSurface)
36 + : iconWidget);
37 + }
38 +}