From 97769b94501420cd8d154cc3146303fae5f8ce8f Mon Sep 17 00:00:00 2001 From: dom Date: Fri, 31 Jul 2026 23:06:09 +0800 Subject: [PATCH] opt ui Signed-off-by: dom --- lib/pages/dynamics_mention/view.dart | 209 +++++++++++++-------------- lib/pages/video/note/view.dart | 60 ++++---- 2 files changed, 135 insertions(+), 134 deletions(-) diff --git a/lib/pages/dynamics_mention/view.dart b/lib/pages/dynamics_mention/view.dart index 5ae4e350d..ccf94fa3d 100644 --- a/lib/pages/dynamics_mention/view.dart +++ b/lib/pages/dynamics_mention/view.dart @@ -86,89 +86,88 @@ class _DynMentionPanelState final theme = Theme.of(context); final padding = MediaQuery.paddingOf(context).bottom; final viewInset = MediaQuery.viewInsetsOf(context).bottom; - return SimpleScaffold( - body: Column( - children: [ - SizedBox( - height: 35, - child: Center( - child: Container( - width: 32, - height: 3, - decoration: BoxDecoration( - color: theme.colorScheme.outline, - borderRadius: const BorderRadius.all(Radius.circular(3)), - ), + return Column( + children: [ + SizedBox( + height: 35, + child: Center( + child: Container( + width: 32, + height: 3, + decoration: BoxDecoration( + color: theme.colorScheme.outline, + borderRadius: const BorderRadius.all(Radius.circular(3)), ), ), ), - Padding( - padding: const EdgeInsets.only(left: 16, right: 16, bottom: 5), - child: TextField( - focusNode: _controller.focusNode, - controller: _controller.controller, - onChanged: ctr!.add, - decoration: InputDecoration( - visualDensity: .standard, - border: const OutlineInputBorder( - gapPadding: 0, - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(25)), - ), - isDense: true, - filled: true, - fillColor: theme.colorScheme.onInverseSurface, - hintText: '输入你想@的人', - hintStyle: const TextStyle(fontSize: 14), - prefixIcon: const Padding( - padding: EdgeInsets.only(left: 12, right: 4), - child: Icon(Icons.search, size: 20), - ), - prefixIconConstraints: const .new(minHeight: 0, minWidth: 0), - contentPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 6, - ), - suffixIcon: Obx( - () => _controller.enableClear.value - ? Padding( - padding: const EdgeInsets.only(right: 12), - child: GestureDetector( - child: Container( - padding: const EdgeInsetsDirectional.all(2), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: theme.colorScheme.secondaryContainer, - ), - child: Icon( - Icons.clear, - size: 16, - color: theme.colorScheme.onSecondaryContainer, - ), + ), + Padding( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 5), + child: TextField( + focusNode: _controller.focusNode, + controller: _controller.controller, + onChanged: ctr!.add, + decoration: InputDecoration( + visualDensity: .standard, + border: const OutlineInputBorder( + gapPadding: 0, + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(25)), + ), + isDense: true, + filled: true, + fillColor: theme.colorScheme.onInverseSurface, + hintText: '输入你想@的人', + hintStyle: const TextStyle(fontSize: 14), + prefixIcon: const Padding( + padding: EdgeInsets.only(left: 12, right: 4), + child: Icon(Icons.search, size: 20), + ), + prefixIconConstraints: const .new(minHeight: 0, minWidth: 0), + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 6, + ), + suffixIcon: Obx( + () => _controller.enableClear.value + ? Padding( + padding: const EdgeInsets.only(right: 12), + child: GestureDetector( + child: Container( + padding: const EdgeInsetsDirectional.all(2), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: theme.colorScheme.secondaryContainer, + ), + child: Icon( + Icons.clear, + size: 16, + color: theme.colorScheme.onSecondaryContainer, ), - onTap: () => _controller - ..enableClear.value = false - ..controller.clear() - ..onRefresh().whenComplete( - () => WidgetsBinding.instance - .addPostFrameCallback( - (_) => - widget.scrollController?.jumpToTop(), - ), - ), ), - ) - : const SizedBox.shrink(), - ), - suffixIconConstraints: const BoxConstraints( - minHeight: 0, - minWidth: 0, - ), + onTap: () => _controller + ..enableClear.value = false + ..controller.clear() + ..onRefresh().whenComplete( + () => + WidgetsBinding.instance.addPostFrameCallback( + (_) => widget.scrollController?.jumpToTop(), + ), + ), + ), + ) + : const SizedBox.shrink(), + ), + suffixIconConstraints: const BoxConstraints( + minHeight: 0, + minWidth: 0, ), ), ), - Expanded( - child: NotificationListener( + ), + Expanded( + child: SimpleScaffold( + body: NotificationListener( onNotification: (notification) { if (notification is UserScrollNotification) { if (_controller.focusNode.hasFocus) { @@ -191,37 +190,37 @@ class _DynMentionPanelState ], ), ), + fab: Obx(() { + return Padding( + padding: .only( + right: kFloatingActionButtonMargin, + bottom: + padding + + kFloatingActionButtonMargin + + (_controller.showBtn.value ? viewInset : 0), + ), + child: AnimatedSlide( + offset: _controller.showBtn.value + ? Offset.zero + : const Offset(0, 3), + duration: const Duration(milliseconds: 120), + child: FloatingActionButton( + onPressed: () { + if (_controller.mentionList.isNullOrEmpty) { + _controller.showBtn.value = false; + return; + } + Get.back(result: _controller.mentionList); + _controller.showBtn.value = false; + }, + child: const Icon(Icons.check), + ), + ), + ); + }), ), - ], - ), - fab: Obx(() { - return Padding( - padding: .only( - right: kFloatingActionButtonMargin, - bottom: - padding + - kFloatingActionButtonMargin + - (_controller.showBtn.value ? viewInset : 0), - ), - child: AnimatedSlide( - offset: _controller.showBtn.value - ? Offset.zero - : const Offset(0, 3), - duration: const Duration(milliseconds: 120), - child: FloatingActionButton( - onPressed: () { - if (_controller.mentionList.isNullOrEmpty) { - _controller.showBtn.value = false; - return; - } - Get.back(result: _controller.mentionList); - _controller.showBtn.value = false; - }, - child: const Icon(Icons.check), - ), - ), - ); - }), + ), + ], ); } diff --git a/lib/pages/video/note/view.dart b/lib/pages/video/note/view.dart index fd0b38178..7c8baf6c1 100644 --- a/lib/pages/video/note/view.dart +++ b/lib/pages/video/note/view.dart @@ -56,38 +56,40 @@ class _NoteListPageState extends State @override Widget buildPage(ThemeData theme) { - return MiniScaffold( - body: Column( - children: [ - SizedBox( - height: 45, - child: AppBar( - primary: false, - automaticallyImplyLeading: false, - titleSpacing: 16, - toolbarHeight: 45, - backgroundColor: Colors.transparent, - title: Obx(() { - final count = _controller.count.value; - return Text('笔记${count == -1 ? '' : '($count)'}'); - }), - shape: Border( - bottom: BorderSide( - color: theme.colorScheme.outline.withValues(alpha: 0.1), + return Material( + child: MiniScaffold( + body: Column( + children: [ + SizedBox( + height: 45, + child: AppBar( + primary: false, + automaticallyImplyLeading: false, + titleSpacing: 16, + toolbarHeight: 45, + backgroundColor: Colors.transparent, + title: Obx(() { + final count = _controller.count.value; + return Text('笔记${count == -1 ? '' : '($count)'}'); + }), + shape: Border( + bottom: BorderSide( + color: theme.colorScheme.outline.withValues(alpha: 0.1), + ), ), + actions: [ + IconButton( + tooltip: '关闭', + icon: const Icon(Icons.close, size: 20), + onPressed: Get.back, + ), + const SizedBox(width: 2), + ], ), - actions: [ - IconButton( - tooltip: '关闭', - icon: const Icon(Icons.close, size: 20), - onPressed: Get.back, - ), - const SizedBox(width: 2), - ], ), - ), - Expanded(child: enableSlide ? slideList(theme) : buildList(theme)), - ], + Expanded(child: enableSlide ? slideList(theme) : buildList(theme)), + ], + ), ), ); }