mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -17,8 +17,10 @@ class LiveDmBlockController extends GetxController
|
||||
queryData();
|
||||
}
|
||||
|
||||
late final TabController tabController =
|
||||
TabController(length: 2, vsync: this);
|
||||
late final TabController tabController = TabController(
|
||||
length: 2,
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
int? oldLevel;
|
||||
final RxInt level = 0.obs;
|
||||
@@ -54,8 +56,11 @@ class LiveDmBlockController extends GetxController
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> setSilent(LiveDmSilentType type, int level,
|
||||
{VoidCallback? onError}) async {
|
||||
Future<bool> setSilent(
|
||||
LiveDmSilentType type,
|
||||
int level, {
|
||||
VoidCallback? onError,
|
||||
}) async {
|
||||
var res = await LiveHttp.liveSetSilent(type: type.name, level: level);
|
||||
if (res['status']) {
|
||||
switch (type) {
|
||||
@@ -108,8 +113,11 @@ class LiveDmBlockController extends GetxController
|
||||
SmartDialog.showToast(res['msg']);
|
||||
}
|
||||
} else {
|
||||
var res =
|
||||
await LiveHttp.liveShieldUser(uid: value, roomid: roomId, type: 1);
|
||||
var res = await LiveHttp.liveShieldUser(
|
||||
uid: value,
|
||||
roomid: roomId,
|
||||
type: 1,
|
||||
);
|
||||
if (res['status']) {
|
||||
shieldUserList.insert(
|
||||
0,
|
||||
@@ -126,8 +134,11 @@ class LiveDmBlockController extends GetxController
|
||||
|
||||
Future<void> onRemove(int index, dynamic item) async {
|
||||
if (item is ShieldUserList) {
|
||||
var res =
|
||||
await LiveHttp.liveShieldUser(uid: item.uid, roomid: roomId, type: 0);
|
||||
var res = await LiveHttp.liveShieldUser(
|
||||
uid: item.uid,
|
||||
roomid: roomId,
|
||||
type: 0,
|
||||
);
|
||||
if (res['status']) {
|
||||
shieldUserList.removeAt(index);
|
||||
} else {
|
||||
|
||||
@@ -21,8 +21,10 @@ class LiveDmBlockPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
final _controller =
|
||||
Get.put(LiveDmBlockController(), tag: Utils.generateRandomString(8));
|
||||
final _controller = Get.put(
|
||||
LiveDmBlockController(),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
late bool isPortrait;
|
||||
|
||||
@override
|
||||
@@ -32,7 +34,10 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
|
||||
Widget tabBar = TabBar(
|
||||
controller: _controller.tabController,
|
||||
tabs: const [Tab(text: '关键词'), Tab(text: '用户')],
|
||||
tabs: const [
|
||||
Tab(text: '关键词'),
|
||||
Tab(text: '用户'),
|
||||
],
|
||||
);
|
||||
|
||||
Widget view = tabBarView(
|
||||
@@ -51,7 +56,10 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
|
||||
Widget title = Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: isPortrait ? 18 : 0, left: isPortrait ? 0 : 12, bottom: 12),
|
||||
top: isPortrait ? 18 : 0,
|
||||
left: isPortrait ? 0 : 12,
|
||||
bottom: 12,
|
||||
),
|
||||
child: const Text(
|
||||
'关键词屏蔽',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold),
|
||||
@@ -90,8 +98,10 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
return [
|
||||
SliverToBoxAdapter(child: left),
|
||||
SliverOverlapAbsorber(
|
||||
handle: ExtendedNestedScrollView
|
||||
.sliverOverlapAbsorberHandleFor(context),
|
||||
handle:
|
||||
ExtendedNestedScrollView.sliverOverlapAbsorberHandleFor(
|
||||
context,
|
||||
),
|
||||
sliver: SliverPersistentHeader(
|
||||
pinned: true,
|
||||
delegate: CustomSliverPersistentHeaderDelegate(
|
||||
@@ -107,9 +117,10 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
builder: (context, _) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: ExtendedNestedScrollView
|
||||
.sliverOverlapAbsorberHandleFor(context)
|
||||
.layoutExtent ??
|
||||
top:
|
||||
ExtendedNestedScrollView.sliverOverlapAbsorberHandleFor(
|
||||
context,
|
||||
).layoutExtent ??
|
||||
0,
|
||||
),
|
||||
child: view,
|
||||
@@ -233,7 +244,7 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
}
|
||||
},
|
||||
),
|
||||
Text('$level 以下')
|
||||
Text('$level 以下'),
|
||||
],
|
||||
);
|
||||
},
|
||||
@@ -273,10 +284,16 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
];
|
||||
}
|
||||
|
||||
Widget _headerBtn(ThemeData theme, bool isEnable, IconData icon, String name,
|
||||
VoidCallback onTap) {
|
||||
final color =
|
||||
isEnable ? theme.colorScheme.primary : theme.colorScheme.outline;
|
||||
Widget _headerBtn(
|
||||
ThemeData theme,
|
||||
bool isEnable,
|
||||
IconData icon,
|
||||
String name,
|
||||
VoidCallback onTap,
|
||||
) {
|
||||
final color = isEnable
|
||||
? theme.colorScheme.primary
|
||||
: theme.colorScheme.outline;
|
||||
|
||||
Widget top = Container(
|
||||
width: 42,
|
||||
@@ -285,7 +302,8 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
decoration: isEnable
|
||||
? BoxDecoration(
|
||||
border: Border.all(color: color),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)))
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
)
|
||||
: null,
|
||||
child: Icon(icon, color: color),
|
||||
);
|
||||
@@ -345,8 +363,9 @@ class _LiveDmBlockPageState extends State<LiveDmBlockPage> {
|
||||
onChanged: (val) => value = val,
|
||||
decoration: isKeyword ? null : const InputDecoration(hintText: 'UID'),
|
||||
keyboardType: isKeyword ? null : TextInputType.number,
|
||||
inputFormatters:
|
||||
isKeyword ? null : [FilteringTextInputFormatter.digitsOnly],
|
||||
inputFormatters: isKeyword
|
||||
? null
|
||||
: [FilteringTextInputFormatter.digitsOnly],
|
||||
),
|
||||
onConfirm: () {
|
||||
if (value.isNotEmpty) {
|
||||
|
||||
Reference in New Issue
Block a user