Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-07-31 23:06:09 +08:00
parent f90d1789cc
commit 97769b9450
2 changed files with 135 additions and 134 deletions

View File

@@ -86,89 +86,88 @@ class _DynMentionPanelState
final theme = Theme.of(context); final theme = Theme.of(context);
final padding = MediaQuery.paddingOf(context).bottom; final padding = MediaQuery.paddingOf(context).bottom;
final viewInset = MediaQuery.viewInsetsOf(context).bottom; final viewInset = MediaQuery.viewInsetsOf(context).bottom;
return SimpleScaffold( return Column(
body: Column( children: [
children: [ SizedBox(
SizedBox( height: 35,
height: 35, child: Center(
child: Center( child: Container(
child: Container( width: 32,
width: 32, height: 3,
height: 3, decoration: BoxDecoration(
decoration: BoxDecoration( color: theme.colorScheme.outline,
color: theme.colorScheme.outline, borderRadius: const BorderRadius.all(Radius.circular(3)),
borderRadius: const BorderRadius.all(Radius.circular(3)),
),
), ),
), ),
), ),
Padding( ),
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 5), Padding(
child: TextField( padding: const EdgeInsets.only(left: 16, right: 16, bottom: 5),
focusNode: _controller.focusNode, child: TextField(
controller: _controller.controller, focusNode: _controller.focusNode,
onChanged: ctr!.add, controller: _controller.controller,
decoration: InputDecoration( onChanged: ctr!.add,
visualDensity: .standard, decoration: InputDecoration(
border: const OutlineInputBorder( visualDensity: .standard,
gapPadding: 0, border: const OutlineInputBorder(
borderSide: BorderSide.none, gapPadding: 0,
borderRadius: BorderRadius.all(Radius.circular(25)), borderSide: BorderSide.none,
), borderRadius: BorderRadius.all(Radius.circular(25)),
isDense: true, ),
filled: true, isDense: true,
fillColor: theme.colorScheme.onInverseSurface, filled: true,
hintText: '输入你想@的人', fillColor: theme.colorScheme.onInverseSurface,
hintStyle: const TextStyle(fontSize: 14), hintText: '输入你想@的人',
prefixIcon: const Padding( hintStyle: const TextStyle(fontSize: 14),
padding: EdgeInsets.only(left: 12, right: 4), prefixIcon: const Padding(
child: Icon(Icons.search, size: 20), padding: EdgeInsets.only(left: 12, right: 4),
), child: Icon(Icons.search, size: 20),
prefixIconConstraints: const .new(minHeight: 0, minWidth: 0), ),
contentPadding: const EdgeInsets.symmetric( prefixIconConstraints: const .new(minHeight: 0, minWidth: 0),
horizontal: 16, contentPadding: const EdgeInsets.symmetric(
vertical: 6, horizontal: 16,
), vertical: 6,
suffixIcon: Obx( ),
() => _controller.enableClear.value suffixIcon: Obx(
? Padding( () => _controller.enableClear.value
padding: const EdgeInsets.only(right: 12), ? Padding(
child: GestureDetector( padding: const EdgeInsets.only(right: 12),
child: Container( child: GestureDetector(
padding: const EdgeInsetsDirectional.all(2), child: Container(
decoration: BoxDecoration( padding: const EdgeInsetsDirectional.all(2),
shape: BoxShape.circle, decoration: BoxDecoration(
color: theme.colorScheme.secondaryContainer, shape: BoxShape.circle,
), color: theme.colorScheme.secondaryContainer,
child: Icon( ),
Icons.clear, child: Icon(
size: 16, Icons.clear,
color: theme.colorScheme.onSecondaryContainer, size: 16,
), color: theme.colorScheme.onSecondaryContainer,
), ),
onTap: () => _controller
..enableClear.value = false
..controller.clear()
..onRefresh().whenComplete(
() => WidgetsBinding.instance
.addPostFrameCallback(
(_) =>
widget.scrollController?.jumpToTop(),
),
),
), ),
) onTap: () => _controller
: const SizedBox.shrink(), ..enableClear.value = false
), ..controller.clear()
suffixIconConstraints: const BoxConstraints( ..onRefresh().whenComplete(
minHeight: 0, () =>
minWidth: 0, WidgetsBinding.instance.addPostFrameCallback(
), (_) => widget.scrollController?.jumpToTop(),
),
),
),
)
: const SizedBox.shrink(),
),
suffixIconConstraints: const BoxConstraints(
minHeight: 0,
minWidth: 0,
), ),
), ),
), ),
Expanded( ),
child: NotificationListener<ScrollNotification>( Expanded(
child: SimpleScaffold(
body: NotificationListener<ScrollNotification>(
onNotification: (notification) { onNotification: (notification) {
if (notification is UserScrollNotification) { if (notification is UserScrollNotification) {
if (_controller.focusNode.hasFocus) { 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),
),
),
);
}),
); );
} }

View File

@@ -56,38 +56,40 @@ class _NoteListPageState extends State<NoteListPage>
@override @override
Widget buildPage(ThemeData theme) { Widget buildPage(ThemeData theme) {
return MiniScaffold( return Material(
body: Column( child: MiniScaffold(
children: [ body: Column(
SizedBox( children: [
height: 45, SizedBox(
child: AppBar( height: 45,
primary: false, child: AppBar(
automaticallyImplyLeading: false, primary: false,
titleSpacing: 16, automaticallyImplyLeading: false,
toolbarHeight: 45, titleSpacing: 16,
backgroundColor: Colors.transparent, toolbarHeight: 45,
title: Obx(() { backgroundColor: Colors.transparent,
final count = _controller.count.value; title: Obx(() {
return Text('笔记${count == -1 ? '' : '($count)'}'); final count = _controller.count.value;
}), return Text('笔记${count == -1 ? '' : '($count)'}');
shape: Border( }),
bottom: BorderSide( shape: Border(
color: theme.colorScheme.outline.withValues(alpha: 0.1), 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)), ],
], ),
), ),
); );
} }