|
| 1 | +// ignore_for_file: public_member_api_docs, sort_constructors_first |
1 | 2 | import 'package:flutter/material.dart'; |
2 | 3 |
|
3 | 4 | @immutable |
4 | 5 | class QuillIconTheme { |
5 | 6 | const QuillIconTheme({ |
6 | | - this.padding, |
7 | 7 | this.iconButtonSelectedStyle, |
8 | 8 | this.iconButtonUnselectedStyle, |
9 | | - // this.iconSelectedFillColor, |
10 | | - // this.iconUnselectedFillColor, |
| 9 | + this.iconButtonSelectedData, |
| 10 | + this.iconButtonUnselectedData, |
11 | 11 | }); |
12 | 12 |
|
| 13 | + @Deprecated('Please use iconButtonUnselectedData instead') |
13 | 14 | final ButtonStyle? iconButtonUnselectedStyle; |
| 15 | + @Deprecated('Please use iconButtonSelectedData instead') |
14 | 16 | final ButtonStyle? iconButtonSelectedStyle; |
15 | 17 |
|
16 | | - // final Color? iconSelectedFillColor; |
17 | | - // final Color? iconUnselectedFillColor; |
| 18 | + final IconButtonData? iconButtonUnselectedData; |
| 19 | + final IconButtonData? iconButtonSelectedData; |
| 20 | + |
| 21 | + QuillIconTheme copyWith({ |
| 22 | + IconButtonData? iconButtonUnselectedData, |
| 23 | + IconButtonData? iconButtonSelectedData, |
| 24 | + }) { |
| 25 | + return QuillIconTheme( |
| 26 | + iconButtonUnselectedData: |
| 27 | + iconButtonUnselectedData ?? this.iconButtonUnselectedData, |
| 28 | + iconButtonSelectedData: |
| 29 | + iconButtonSelectedData ?? this.iconButtonSelectedData, |
| 30 | + ); |
| 31 | + } |
| 32 | +} |
| 33 | + |
| 34 | +@immutable |
| 35 | +class IconButtonData { |
| 36 | + const IconButtonData({ |
| 37 | + this.iconSize, |
| 38 | + this.visualDensity, |
| 39 | + this.padding, |
| 40 | + this.alignment, |
| 41 | + this.splashRadius, |
| 42 | + this.color, |
| 43 | + this.focusColor, |
| 44 | + this.hoverColor, |
| 45 | + this.highlightColor, |
| 46 | + this.splashColor, |
| 47 | + this.disabledColor, |
| 48 | + this.mouseCursor, |
| 49 | + this.autofocus = false, |
| 50 | + this.tooltip, |
| 51 | + this.enableFeedback, |
| 52 | + this.constraints, |
| 53 | + this.style, |
| 54 | + this.isSelected, |
| 55 | + this.selectedIcon, |
| 56 | + }); |
| 57 | + |
| 58 | + final double? iconSize; |
| 59 | + final VisualDensity? visualDensity; |
| 60 | + final EdgeInsetsGeometry? padding; |
| 61 | + final AlignmentGeometry? alignment; |
| 62 | + final double? splashRadius; |
| 63 | + final Color? color; |
| 64 | + final Color? focusColor; |
| 65 | + final Color? hoverColor; |
| 66 | + final Color? highlightColor; |
| 67 | + final Color? splashColor; |
| 68 | + final Color? disabledColor; |
| 69 | + final MouseCursor? mouseCursor; |
| 70 | + final bool autofocus; |
| 71 | + final String? tooltip; |
| 72 | + final bool? enableFeedback; |
| 73 | + final BoxConstraints? constraints; |
| 74 | + final ButtonStyle? style; |
| 75 | + final bool? isSelected; |
| 76 | + final Widget? selectedIcon; |
18 | 77 |
|
19 | | - ///The padding for icons |
20 | | - final EdgeInsets? padding; |
| 78 | + IconButtonData copyWith({ |
| 79 | + double? iconSize, |
| 80 | + VisualDensity? visualDensity, |
| 81 | + EdgeInsetsGeometry? padding, |
| 82 | + AlignmentGeometry? alignment, |
| 83 | + double? splashRadius, |
| 84 | + Color? color, |
| 85 | + Color? focusColor, |
| 86 | + Color? hoverColor, |
| 87 | + Color? highlightColor, |
| 88 | + Color? splashColor, |
| 89 | + Color? disabledColor, |
| 90 | + MouseCursor? mouseCursor, |
| 91 | + bool? autofocus, |
| 92 | + String? tooltip, |
| 93 | + bool? enableFeedback, |
| 94 | + BoxConstraints? constraints, |
| 95 | + ButtonStyle? style, |
| 96 | + bool? isSelected, |
| 97 | + Widget? selectedIcon, |
| 98 | + }) { |
| 99 | + return IconButtonData( |
| 100 | + iconSize: iconSize ?? this.iconSize, |
| 101 | + visualDensity: visualDensity ?? this.visualDensity, |
| 102 | + padding: padding ?? this.padding, |
| 103 | + alignment: alignment ?? this.alignment, |
| 104 | + splashRadius: splashRadius ?? this.splashRadius, |
| 105 | + color: color ?? this.color, |
| 106 | + focusColor: focusColor ?? this.focusColor, |
| 107 | + hoverColor: hoverColor ?? this.hoverColor, |
| 108 | + highlightColor: highlightColor ?? this.highlightColor, |
| 109 | + splashColor: splashColor ?? this.splashColor, |
| 110 | + disabledColor: disabledColor ?? this.disabledColor, |
| 111 | + mouseCursor: mouseCursor ?? this.mouseCursor, |
| 112 | + autofocus: autofocus ?? this.autofocus, |
| 113 | + tooltip: tooltip ?? this.tooltip, |
| 114 | + enableFeedback: enableFeedback ?? this.enableFeedback, |
| 115 | + constraints: constraints ?? this.constraints, |
| 116 | + style: style ?? this.style, |
| 117 | + isSelected: isSelected ?? this.isSelected, |
| 118 | + selectedIcon: selectedIcon ?? this.selectedIcon, |
| 119 | + ); |
| 120 | + } |
21 | 121 | } |
0 commit comments