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 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<ScrollNotification>(
),
Expanded(
child: SimpleScaffold(
body: NotificationListener<ScrollNotification>(
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),
),
),
);
}),
),
],
);
}

View File

@@ -56,38 +56,40 @@ class _NoteListPageState extends State<NoteListPage>
@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)),
],
),
),
);
}