forked from alesimula/wsa_pacman
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom text box, use card for port option
- Loading branch information
Showing
3 changed files
with
709 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// ignore_for_file: constant_identifier_names | ||
|
||
import 'package:fluent_ui/fluent_ui.dart'; | ||
|
||
enum IconButtonMode { | ||
TINY, SMALL, LARGE | ||
} | ||
|
||
class FluentIconButton extends BaseButton { | ||
const FluentIconButton({ | ||
Key? key, | ||
required Widget icon, | ||
required VoidCallback? onPressed, | ||
VoidCallback? onLongPress, | ||
FocusNode? focusNode, | ||
bool autofocus = false, | ||
ButtonStyle? style, | ||
this.iconButtonMode, | ||
}) : super( | ||
key: key, | ||
child: icon, | ||
focusNode: focusNode, | ||
autofocus: autofocus, | ||
onLongPress: onLongPress, | ||
onPressed: onPressed, | ||
style: style, | ||
); | ||
|
||
final IconButtonMode? iconButtonMode; | ||
|
||
@override | ||
ButtonStyle defaultStyleOf(BuildContext context) { | ||
assert(debugCheckHasFluentTheme(context)); | ||
final theme = FluentTheme.of(context); | ||
final isIconSmall = iconButtonMode == IconButtonMode.TINY; | ||
final isSmall = iconButtonMode != null ? iconButtonMode != IconButtonMode.LARGE : SmallIconButton.of(context) != null; | ||
return ButtonStyle( | ||
iconSize: ButtonState.all(isIconSmall ? 12.0 : null), | ||
padding: ButtonState.all(isSmall | ||
? const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0) | ||
: const EdgeInsets.all(8.0)), | ||
backgroundColor: ButtonState.resolveWith((states) { | ||
return states.isDisabled | ||
? ButtonThemeData.buttonColor(theme.brightness, states) | ||
: ButtonThemeData.uncheckedInputColor(theme, states); | ||
}), | ||
foregroundColor: ButtonState.resolveWith((states) { | ||
if (states.isDisabled) return theme.disabledColor; | ||
}), | ||
shape: ButtonState.all(RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(4.0), | ||
)), | ||
); | ||
} | ||
|
||
@override | ||
ButtonStyle? themeStyleOf(BuildContext context) { | ||
assert(debugCheckHasFluentTheme(context)); | ||
return ButtonTheme.of(context).iconButtonStyle; | ||
} | ||
} |
Oops, something went wrong.