mod: bottomSheet样式

This commit is contained in:
guozhigq
2024-08-26 23:48:12 +08:00
parent a5e2414a75
commit cc5f432f4a
5 changed files with 201 additions and 215 deletions

View File

@ -49,7 +49,10 @@ class FollowItem extends StatelessWidget {
child: TextButton( child: TextButton(
onPressed: () async { onPressed: () async {
await showFlexibleBottomSheet( await showFlexibleBottomSheet(
bottomSheetColor: Colors.transparent, bottomSheetBorderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
minHeight: 1, minHeight: 1,
initHeight: 1, initHeight: 1,
maxHeight: 1, maxHeight: 1,

View File

@ -519,7 +519,10 @@ class VideoIntroController extends GetxController {
// 设置关注分组 // 设置关注分组
void setFollowGroup() { void setFollowGroup() {
showFlexibleBottomSheet( showFlexibleBottomSheet(
bottomSheetColor: Colors.transparent, bottomSheetBorderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
minHeight: 0.6, minHeight: 0.6,
initHeight: 0.6, initHeight: 0.6,
maxHeight: 1, maxHeight: 1,

View File

@ -230,7 +230,10 @@ class _VideoInfoState extends State<VideoInfo> with TickerProviderStateMixin {
void _showFavPanel() { void _showFavPanel() {
showFlexibleBottomSheet( showFlexibleBottomSheet(
bottomSheetColor: Colors.transparent, bottomSheetBorderRadius: const BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
minHeight: 0.6, minHeight: 0.6,
initHeight: 0.6, initHeight: 0.6,
maxHeight: 1, maxHeight: 1,

View File

@ -26,128 +26,116 @@ class _FavPanelState extends State<FavPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Column(
clipBehavior: Clip.hardEdge, children: [
decoration: BoxDecoration( AppBar(
color: Theme.of(context).colorScheme.surface, centerTitle: false,
borderRadius: const BorderRadius.only( elevation: 0,
topLeft: Radius.circular(16), automaticallyImplyLeading: false,
topRight: Radius.circular(16), leadingWidth: 0,
title: Text(
'选择收藏夹',
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontWeight: FontWeight.bold),
),
), ),
), Expanded(
child: Column( child: Material(
children: [ child: FutureBuilder(
AppBar( future: _futureBuilderFuture,
centerTitle: false, builder: (BuildContext context, AsyncSnapshot snapshot) {
elevation: 0, if (snapshot.connectionState == ConnectionState.done) {
automaticallyImplyLeading: false, Map data = snapshot.data as Map;
leadingWidth: 0, if (data['status']) {
title: Text( return Obx(
'选择收藏夹', () => ListView.builder(
style: Theme.of(context) controller: widget.scrollController,
.textTheme itemCount: widget.ctr!.favFolderData.value.list!.length,
.titleMedium! itemBuilder: (context, index) {
.copyWith(fontWeight: FontWeight.bold), final item =
), widget.ctr!.favFolderData.value.list![index];
), return ListTile(
Expanded( onTap: () =>
child: Material( widget.ctr!.onChoose(item.favState != 1, index),
child: FutureBuilder( dense: true,
future: _futureBuilderFuture, leading: const Icon(Icons.folder_outlined),
builder: (BuildContext context, AsyncSnapshot snapshot) { minLeadingWidth: 0,
if (snapshot.connectionState == ConnectionState.done) { title: Text(widget
Map data = snapshot.data as Map; .ctr!.favFolderData.value.list![index].title!),
if (data['status']) { subtitle: Text(
return Obx( '${item.mediaCount}个内容 ',
() => ListView.builder( ),
controller: widget.scrollController, trailing: Transform.scale(
itemCount: scale: 0.9,
widget.ctr!.favFolderData.value.list!.length, child: Checkbox(
itemBuilder: (context, index) { value: widget.ctr!.favFolderData.value
final item = .list![index].favState ==
widget.ctr!.favFolderData.value.list![index]; 1,
return ListTile( onChanged: (bool? checkValue) =>
onTap: () => widget.ctr! widget.ctr!.onChoose(checkValue!, index),
.onChoose(item.favState != 1, index),
dense: true,
leading: const Icon(Icons.folder_outlined),
minLeadingWidth: 0,
title: Text(widget.ctr!.favFolderData.value
.list![index].title!),
subtitle: Text(
'${item.mediaCount}个内容 ',
), ),
trailing: Transform.scale( ),
scale: 0.9, );
child: Checkbox( },
value: widget.ctr!.favFolderData.value ),
.list![index].favState == );
1,
onChanged: (bool? checkValue) =>
widget.ctr!.onChoose(checkValue!, index),
),
),
);
},
),
);
} else {
return HttpError(
errMsg: data['msg'],
fn: () => setState(() {}),
);
}
} else { } else {
// 骨架屏 return HttpError(
return const Text('请求中'); errMsg: data['msg'],
fn: () => setState(() {}),
);
} }
}, } else {
// 骨架屏
return const Text('请求中');
}
},
),
),
),
Divider(
height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () => Get.back(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
backgroundColor:
Theme.of(context).colorScheme.onInverseSurface, // 设置按钮背景色
),
child: const Text('取消'),
), ),
), const SizedBox(width: 10),
), TextButton(
Divider( onPressed: () async {
height: 1, feedBack();
color: Theme.of(context).disabledColor.withOpacity(0.08), await widget.ctr!.actionFavVideo();
), },
Padding( style: TextButton.styleFrom(
padding: EdgeInsets.only( padding: const EdgeInsets.only(left: 30, right: 30),
left: 20, foregroundColor: Theme.of(context).colorScheme.onPrimary,
right: 20, backgroundColor:
top: 12, Theme.of(context).colorScheme.primary, // 设置按钮背景色
bottom: MediaQuery.of(context).padding.bottom + 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () => Get.back(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
backgroundColor: Theme.of(context)
.colorScheme
.onInverseSurface, // 设置按钮背景色
),
child: const Text('取消'),
), ),
const SizedBox(width: 10), child: const Text('确认'),
TextButton( ),
onPressed: () async { ],
feedBack();
await widget.ctr!.actionFavVideo();
},
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
foregroundColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor:
Theme.of(context).colorScheme.primary, // 设置按钮背景色
),
child: const Text('确认选择'),
),
],
),
), ),
], ),
), ],
); );
} }
} }

View File

@ -54,112 +54,101 @@ class _GroupPanelState extends State<GroupPanel> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Column(
clipBehavior: Clip.hardEdge, children: <Widget>[
decoration: BoxDecoration( AppBar(
color: Theme.of(context).colorScheme.surface, centerTitle: false,
borderRadius: const BorderRadius.only( elevation: 0,
topLeft: Radius.circular(16), leading: IconButton(
topRight: Radius.circular(16), onPressed: () => Get.back(),
icon: const Icon(Icons.close_outlined)),
title: Text('设置关注分组', style: Theme.of(context).textTheme.titleMedium),
), ),
), Expanded(
child: Column( child: Material(
children: <Widget>[ child: FutureBuilder(
AppBar( future: _futureBuilderFuture,
centerTitle: false, builder: (BuildContext context, AsyncSnapshot snapshot) {
elevation: 0, if (snapshot.connectionState == ConnectionState.done) {
leading: IconButton( Map data = snapshot.data as Map;
onPressed: () => Get.back(), if (data['status']) {
icon: const Icon(Icons.close_outlined)), tagsList = data['data'];
title: return ListView.builder(
Text('设置关注分组', style: Theme.of(context).textTheme.titleMedium), controller: widget.scrollController,
), itemCount: data['data'].length,
Expanded( itemBuilder: (context, index) {
child: Material( return ListTile(
child: FutureBuilder( onTap: () {
future: _futureBuilderFuture, data['data'][index].checked =
builder: (BuildContext context, AsyncSnapshot snapshot) { !data['data'][index].checked;
if (snapshot.connectionState == ConnectionState.done) { showDefault =
Map data = snapshot.data as Map; !data['data'].any((e) => e.checked == true);
if (data['status']) { setState(() {});
tagsList = data['data']; },
return ListView.builder( dense: true,
controller: widget.scrollController, leading: const Icon(Icons.group_outlined),
itemCount: data['data'].length, minLeadingWidth: 0,
itemBuilder: (context, index) { title: Text(data['data'][index].name),
return ListTile( subtitle: data['data'][index].tip != ''
onTap: () { ? Text(data['data'][index].tip)
data['data'][index].checked = : null,
!data['data'][index].checked; trailing: Transform.scale(
showDefault = scale: 0.9,
!data['data'].any((e) => e.checked == true); child: Checkbox(
setState(() {}); value: data['data'][index].checked,
}, onChanged: (bool? checkValue) {
dense: true, data['data'][index].checked = checkValue;
leading: const Icon(Icons.group_outlined), showDefault =
minLeadingWidth: 0, !data['data'].any((e) => e.checked == true);
title: Text(data['data'][index].name), setState(() {});
subtitle: data['data'][index].tip != '' },
? Text(data['data'][index].tip)
: null,
trailing: Transform.scale(
scale: 0.9,
child: Checkbox(
value: data['data'][index].checked,
onChanged: (bool? checkValue) {
data['data'][index].checked = checkValue;
showDefault = !data['data']
.any((e) => e.checked == true);
setState(() {});
},
),
), ),
); ),
}, );
); },
} else { );
return HttpError(
errMsg: data['msg'],
fn: () => setState(() {}),
);
}
} else { } else {
// 骨架屏 return HttpError(
return const Text('请求中'); errMsg: data['msg'],
fn: () => setState(() {}),
);
} }
}, } else {
), // 骨架屏
return const Text('请求中');
}
},
), ),
), ),
Divider( ),
height: 1, Divider(
color: Theme.of(context).disabledColor.withOpacity(0.08), height: 1,
color: Theme.of(context).disabledColor.withOpacity(0.08),
),
Padding(
padding: EdgeInsets.only(
left: 20,
right: 20,
top: 12,
bottom: MediaQuery.of(context).padding.bottom + 12,
), ),
Padding( child: Row(
padding: EdgeInsets.only( mainAxisAlignment: MainAxisAlignment.end,
left: 20, children: [
right: 20, TextButton(
top: 12, onPressed: () => onSave(),
bottom: MediaQuery.of(context).padding.bottom + 12, style: TextButton.styleFrom(
), padding: const EdgeInsets.only(left: 30, right: 30),
child: Row( foregroundColor: Theme.of(context).colorScheme.onPrimary,
mainAxisAlignment: MainAxisAlignment.end, backgroundColor:
children: [ Theme.of(context).colorScheme.primary, // 设置按钮背景色
TextButton(
onPressed: () => onSave(),
style: TextButton.styleFrom(
padding: const EdgeInsets.only(left: 30, right: 30),
foregroundColor: Theme.of(context).colorScheme.onPrimary,
backgroundColor:
Theme.of(context).colorScheme.primary, // 设置按钮背景色
),
child: Text(showDefault ? '保存至默认分组' : '保存'),
), ),
], child: Text(showDefault ? '保存至默认分组' : '保存'),
), ),
],
), ),
], ),
), ],
); );
} }
} }