opt: create dynamic btn

This commit is contained in:
bggRGjQaUbCoE
2024-10-01 23:42:38 +08:00
parent 9d816d1b96
commit aeef2e147b
3 changed files with 42 additions and 33 deletions

View File

@@ -102,7 +102,7 @@ class BangumiIntroController extends CommonController {
var result = await UserHttp.videoTags(bvid: bvid);
if (result['status']) {
videoTags = result['data'];
debugPrint('tags: ${result['data']}');
// debugPrint('tags: ${result['data']}');
}
}

View File

@@ -35,6 +35,39 @@ class _DynamicsPageState extends State<DynamicsPage>
@override
bool get wantKeepAlive => true;
Widget _createDynamicBtn([bool isRight = true]) => Center(
child: Container(
width: 34,
height: 34,
margin:
EdgeInsets.only(left: !isRight ? 16 : 0, right: isRight ? 16 : 0),
child: IconButton(
tooltip: '发布动态',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.secondaryContainer;
}),
),
onPressed: () {
if (GStorage.userInfo.get('userInfoCache') != null) {
showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (_) => const CreatePanel(),
);
}
},
icon: Icon(
Icons.add,
size: 18,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
),
),
);
@override
void initState() {
super.initState();
@@ -123,6 +156,10 @@ class _DynamicsPageState extends State<DynamicsPage>
return Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
leading: upPanelPosition == UpPanelPosition.rightDrawer
? _createDynamicBtn(false)
: null,
leadingWidth: 50,
toolbarHeight: 50,
elevation: 0,
backgroundColor: Colors.transparent,
@@ -157,37 +194,9 @@ class _DynamicsPageState extends State<DynamicsPage>
},
),
),
actions: [
Container(
width: 34,
height: 34,
margin: const EdgeInsets.only(right: 16),
child: IconButton(
tooltip: '发布动态',
style: ButtonStyle(
padding: WidgetStateProperty.all(EdgeInsets.zero),
backgroundColor: WidgetStateProperty.resolveWith((states) {
return Theme.of(context).colorScheme.secondaryContainer;
}),
),
onPressed: () {
if (GStorage.userInfo.get('userInfoCache') != null) {
showModalBottomSheet(
context: context,
useSafeArea: true,
isScrollControlled: true,
builder: (_) => const CreatePanel(),
);
}
},
icon: Icon(
Icons.add,
size: 18,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
),
),
],
actions: upPanelPosition == UpPanelPosition.rightDrawer
? null
: [_createDynamicBtn()],
),
drawer: upPanelPosition == UpPanelPosition.leftDrawer
? SafeArea(child: upPanelPart())

View File

@@ -167,7 +167,7 @@ class VideoIntroController extends GetxController {
var result = await UserHttp.videoTags(bvid: bvid);
if (result['status']) {
videoTags = result['data'];
debugPrint('tags: ${result['data']}');
// debugPrint('tags: ${result['data']}');
}
}