mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 08:38:18 +08:00
tweaks (#1187)
* opt: marquee * fix: bangumi seek * opt: post panel * opt: remove deprecated code * opt: singleton dynController * fix: music scheme * feat: MemberVideo jump keep position * tweak
This commit is contained in:
committed by
GitHub
parent
e8a674ca2a
commit
172389b12b
70
lib/pages/video/post_panel/popup_menu_text.dart
Normal file
70
lib/pages/video/post_panel/popup_menu_text.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
||||
class PopupMenuText<T> extends StatefulWidget {
|
||||
final String title;
|
||||
final T initialValue;
|
||||
final PopupMenuItemSelected<T> onSelected;
|
||||
final PopupMenuItemBuilder<T> itemBuilder;
|
||||
final String Function(T) getSelectTitle;
|
||||
|
||||
const PopupMenuText({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.initialValue,
|
||||
required this.onSelected,
|
||||
required this.itemBuilder,
|
||||
required this.getSelectTitle,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PopupMenuText<T>> createState() => _PopupMenuTextState();
|
||||
}
|
||||
|
||||
class _PopupMenuTextState<T> extends State<PopupMenuText<T>> {
|
||||
late T select = widget.initialValue;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text('${widget.title}: '),
|
||||
PopupMenuButton<T>(
|
||||
initialValue: select,
|
||||
onSelected: (value) {
|
||||
if (value == select) return;
|
||||
setState(() {
|
||||
select = value;
|
||||
widget.onSelected(value);
|
||||
});
|
||||
},
|
||||
itemBuilder: widget.itemBuilder,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
widget.getSelectTitle(select),
|
||||
style: TextStyle(
|
||||
height: 1,
|
||||
fontSize: 14,
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
strutStyle: const StrutStyle(
|
||||
height: 1,
|
||||
leading: 0,
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
MdiIcons.unfoldMoreHorizontal,
|
||||
size: MediaQuery.textScalerOf(context).scale(14),
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user