这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: remove Material around PopupMenuButton #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions lib/view/dialog/image_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,32 @@ class ImageDialog extends HookConsumerWidget {
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
child: SafeArea(
child: Stack(
children: [
Align(
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: IconButton(
tooltip:
MaterialLocalizations.of(context).closeButtonTooltip,
style: IconButton.styleFrom(
backgroundColor: Colors.white54,
),
onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
),
),
if (url case final url?)
child: IconButtonTheme(
data: IconButtonThemeData(
style: IconButton.styleFrom(backgroundColor: Colors.white54),
),
child: Stack(
children: [
Align(
alignment: AlignmentDirectional.topEnd,
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Material(
color: Colors.white54,
shape: const OvalBorder(),
child: IconButton(
tooltip:
MaterialLocalizations.of(
context,
).closeButtonTooltip,

onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
),
),
if (url case final url?)
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: PopupMenuButton<void>(
itemBuilder:
(context) => [
Expand Down Expand Up @@ -156,8 +157,8 @@ class ImageDialog extends HookConsumerWidget {
),
),
),
),
],
],
),
),
),
),
Expand Down
178 changes: 89 additions & 89 deletions lib/view/dialog/image_gallery_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,30 +183,31 @@ class ImageGalleryDialog extends HookConsumerWidget {
duration: const Duration(milliseconds: 100),
curve: Curves.easeInOut,
child: SafeArea(
child: Stack(
children: [
Align(
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: IconButton(
tooltip:
MaterialLocalizations.of(context).closeButtonTooltip,
style: IconButton.styleFrom(
backgroundColor: Colors.white54,
child: IconButtonTheme(
data: IconButtonThemeData(
style: IconButton.styleFrom(backgroundColor: Colors.white54),
),
child: Stack(
children: [
Align(
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: IconButton(
tooltip:
MaterialLocalizations.of(
context,
).closeButtonTooltip,

onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
),
),
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Material(
color: Colors.white54,
shape: const OvalBorder(),
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: PopupMenuButton<void>(
itemBuilder:
(context) => [
Expand Down Expand Up @@ -254,80 +255,79 @@ class ImageGalleryDialog extends HookConsumerWidget {
),
),
),
),
if (index.value > 0)
Align(
alignment: AlignmentDirectional.centerStart,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.white54,
if (index.value > 0)
Align(
alignment: AlignmentDirectional.centerStart,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
onPressed:
() => controller.previousPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
),
icon: const Icon(Icons.navigate_before),
),
),
),
if (index.value < files.length - 1)
Align(
alignment: AlignmentDirectional.centerEnd,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.white54,
),
onPressed:
() => controller.nextPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
),
icon: const Icon(Icons.navigate_next),
),
onPressed:
() => controller.previousPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
),
icon: const Icon(Icons.navigate_before),
),
),
),
if (index.value < files.length - 1)
Align(
alignment: AlignmentDirectional.centerEnd,
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
style: IconButton.styleFrom(
backgroundColor: Colors.white54,
),
onPressed:
() => controller.nextPage(
duration: const Duration(milliseconds: 300),
curve: Curves.easeIn,
child: GestureDetector(
onLongPress:
() => copyToClipboard(
context,
comment != null && comment.isNotEmpty
? comment
: files[index.value].name,
),
icon: const Icon(Icons.navigate_next),
),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onLongPress:
() => copyToClipboard(
context,
comment != null && comment.isNotEmpty
? comment
: files[index.value].name,
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.white38,
borderRadius: BorderRadius.circular(8.0),
),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.white38,
borderRadius: BorderRadius.circular(8.0),
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 100.0),
child: SingleChildScrollView(
child: Text(
comment != null && comment.isNotEmpty
? comment
: files[index.value].name,
style: TextStyle(
shadows: [
Shadow(
blurRadius: 2.0,
color: Theme.of(context).canvasColor,
),
Shadow(
blurRadius: 2.0,
color: Theme.of(context).canvasColor,
),
],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: ConstrainedBox(
constraints: const BoxConstraints(
maxHeight: 100.0,
),
child: SingleChildScrollView(
child: Text(
comment != null && comment.isNotEmpty
? comment
: files[index.value].name,
style: TextStyle(
shadows: [
Shadow(
blurRadius: 2.0,
color: Theme.of(context).canvasColor,
),
Shadow(
blurRadius: 2.0,
color: Theme.of(context).canvasColor,
),
],
),
),
),
),
Expand All @@ -336,8 +336,8 @@ class ImageGalleryDialog extends HookConsumerWidget {
),
),
),
),
],
],
),
),
),
),
Expand Down
52 changes: 26 additions & 26 deletions lib/view/dialog/video_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@ class VideoDialog extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
return Stack(
children: [
Dismissible(
key: const ValueKey(0),
onDismissed: (_) => context.pop(),
direction: DismissDirection.vertical,
child: Center(child: _VideoWidget(url: url, file: file)),
),
Align(
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: IconButton(
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
style: IconButton.styleFrom(backgroundColor: Colors.white54),
onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
return IconButtonTheme(
data: IconButtonThemeData(
style: IconButton.styleFrom(backgroundColor: Colors.white54),
),
child: Stack(
children: [
Dismissible(
key: const ValueKey(0),
onDismissed: (_) => context.pop(),
direction: DismissDirection.vertical,
child: Center(child: _VideoWidget(url: url, file: file)),
),
),
if (url case final url?)
Align(
alignment: AlignmentDirectional.topEnd,
alignment: AlignmentDirectional.topStart,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Material(
color: Colors.white54,
shape: const OvalBorder(),
child: IconButton(
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
onPressed: () => context.pop(),
icon: const Icon(Icons.close),
),
),
),
if (url case final url?)
Align(
alignment: AlignmentDirectional.topEnd,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: PopupMenuButton<void>(
itemBuilder:
(context) => [
Expand Down Expand Up @@ -91,8 +91,8 @@ class VideoDialog extends ConsumerWidget {
),
),
),
),
],
],
),
);
}
}
Expand Down
Loading