mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-01-28 16:17:03 +00:00
Use CupertinoButton.tinted on iOS instead of IconButton
This commit is contained in:
parent
a1df22ae75
commit
504cc206f7
1 changed files with 32 additions and 25 deletions
|
@ -45,31 +45,7 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
|
||||||
|
|
||||||
return SimplePage(
|
return SimplePage(
|
||||||
title: title,
|
title: title,
|
||||||
trailingActions: [
|
trailingActions: [Padding(padding: const EdgeInsets.only(right: 8), child: _buildTextWrapToggle())],
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 8),
|
|
||||||
child: IconButton.filledTonal(
|
|
||||||
// Fixes enormous button on iOS, this *should* be the default, but it seems to be overridden.
|
|
||||||
iconSize: 24,
|
|
||||||
style: Platform.isIOS
|
|
||||||
? IconButton.styleFrom(
|
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
|
||||||
// Match background when not selected on iOS
|
|
||||||
backgroundColor: settings.logWrap ? null : Colors.transparent,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
isSelected: settings.logWrap,
|
|
||||||
tooltip: "Turn ${settings.logWrap ? "off" : "on"} text wrapping",
|
|
||||||
selectedIcon: const Icon(Icons.wrap_text_outlined),
|
|
||||||
icon: const Icon(Icons.wrap_text),
|
|
||||||
onPressed: () => {
|
|
||||||
setState(() {
|
|
||||||
settings.logWrap = !settings.logWrap;
|
|
||||||
})
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
scrollable: SimpleScrollable.both,
|
scrollable: SimpleScrollable.both,
|
||||||
scrollController: controller,
|
scrollController: controller,
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
|
@ -89,6 +65,37 @@ class _SiteLogsScreenState extends State<SiteLogsScreen> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildTextWrapToggle() {
|
||||||
|
return Platform.isIOS
|
||||||
|
? Tooltip(
|
||||||
|
message: "Turn ${settings.logWrap ? "off" : "on"} text wrapping",
|
||||||
|
child: CupertinoButton.tinted(
|
||||||
|
// Use the default tint when enabled, match the background when not.
|
||||||
|
color: settings.logWrap ? null : CupertinoColors.systemBackground,
|
||||||
|
sizeStyle: CupertinoButtonSize.small,
|
||||||
|
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||||
|
child: const Icon(Icons.wrap_text),
|
||||||
|
onPressed: () => {
|
||||||
|
setState(() {
|
||||||
|
settings.logWrap = !settings.logWrap;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: IconButton.filledTonal(
|
||||||
|
isSelected: settings.logWrap,
|
||||||
|
tooltip: "Turn ${settings.logWrap ? "off" : "on"} text wrapping",
|
||||||
|
// The variants of wrap_text seem to be the same, but this seems most correct.
|
||||||
|
selectedIcon: const Icon(Icons.wrap_text_outlined),
|
||||||
|
icon: const Icon(Icons.wrap_text),
|
||||||
|
onPressed: () => {
|
||||||
|
setState(() {
|
||||||
|
settings.logWrap = !settings.logWrap;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildBottomBar() {
|
Widget _buildBottomBar() {
|
||||||
var borderSide = BorderSide(
|
var borderSide = BorderSide(
|
||||||
color: CupertinoColors.separator,
|
color: CupertinoColors.separator,
|
||||||
|
|
Loading…
Reference in a new issue