mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-30 23:58:13 +08:00
opt action item
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -17,7 +17,7 @@ class ActionItem extends StatefulWidget {
|
|||||||
final bool needAnim;
|
final bool needAnim;
|
||||||
final bool hasTriple;
|
final bool hasTriple;
|
||||||
final ValueChanged<bool>? callBack;
|
final ValueChanged<bool>? callBack;
|
||||||
final bool? expand;
|
final bool expand;
|
||||||
|
|
||||||
const ActionItem({
|
const ActionItem({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -31,7 +31,7 @@ class ActionItem extends StatefulWidget {
|
|||||||
this.hasTriple = false,
|
this.hasTriple = false,
|
||||||
this.callBack,
|
this.callBack,
|
||||||
required this.semanticsLabel,
|
required this.semanticsLabel,
|
||||||
this.expand,
|
this.expand = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -121,17 +121,29 @@ class ActionItemState extends State<ActionItem>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final hasText = widget.text != null;
|
Widget? text;
|
||||||
final text = Text(
|
if (widget.expand) {
|
||||||
hasText ? widget.text! : '-',
|
final hasText = widget.text != null;
|
||||||
key: hasText ? ValueKey(widget.text!) : null,
|
text = Text(
|
||||||
style: TextStyle(
|
hasText ? widget.text! : '-',
|
||||||
color: widget.selectStatus
|
key: hasText ? ValueKey(widget.text!) : null,
|
||||||
? theme.colorScheme.primary
|
style: TextStyle(
|
||||||
: theme.colorScheme.outline,
|
color: widget.selectStatus
|
||||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
? theme.colorScheme.primary
|
||||||
),
|
: theme.colorScheme.outline,
|
||||||
);
|
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
if (hasText) {
|
||||||
|
text = AnimatedSwitcher(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||||
|
return ScaleTransition(scale: animation, child: child);
|
||||||
|
},
|
||||||
|
child: text,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
final child = Material(
|
final child = Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -177,21 +189,12 @@ class ActionItemState extends State<ActionItem>
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (widget.text != null)
|
?text,
|
||||||
AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 300),
|
|
||||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
|
||||||
return ScaleTransition(scale: animation, child: child);
|
|
||||||
},
|
|
||||||
child: text,
|
|
||||||
)
|
|
||||||
else
|
|
||||||
text
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return widget.expand == false ? child : Expanded(child: child);
|
return widget.expand ? Expanded(child: child) : child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
|
|||||||
version: 1.1.3+1
|
version: 1.1.3+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.8.0 <4.0.0"
|
||||||
flutter: 3.32.7
|
flutter: 3.32.7
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
# Dependencies specify other packages that your package needs in order to work.
|
||||||
|
|||||||
Reference in New Issue
Block a user