mass migrate to adaptive sheets

This commit is contained in:
Henry Hiles 2026-10-15 20:06:37 -04:00
commit 9117663c48
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
13 changed files with 292 additions and 289 deletions

View file

@ -1,5 +1,6 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:material_ui/material_ui.dart";
import "package:nexus/widgets/sheet_layout.dart";
import "package:flutter/services.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
@ -46,27 +47,13 @@ extension BuildEventOptions on Event {
required String action,
required Future<void> Function(String reason) onConfirm,
}) {
showDialog(
context: context,
builder: (context) => HookBuilder(
context.showAdaptiveSheet(
(context) => HookBuilder(
builder: (context) {
final reasonController = useTextEditingController();
return AlertDialog(
return SheetLayout(
title: Text(title),
content: Column(
mainAxisSize: .min,
crossAxisAlignment: .start,
children: [
Text(description),
const SizedBox(height: 12),
TextField(
controller: reasonController,
textCapitalization: .sentences,
decoration: .new(labelText: "Reason (optional)"),
),
],
),
actions: [
TextButton(
onPressed: Navigator.of(context).pop,
@ -82,6 +69,14 @@ extension BuildEventOptions on Event {
child: Text(action),
),
],
children: [
Text(description),
TextField(
controller: reasonController,
textCapitalization: .sentences,
decoration: .new(labelText: "Reason (optional)"),
),
],
);
},
),

View file

@ -1,4 +1,6 @@
import "package:material_ui/material_ui.dart";
import "package:nexus/helpers/extensions/show_adaptive_sheet.dart";
import "package:nexus/widgets/sheet_layout.dart";
import "package:flutter_svg/flutter_svg.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:m3e_card_list/m3e_card_list.dart";
@ -10,64 +12,8 @@ extension ShowAboutDialog on BuildContext {
final packageInfo = await PackageInfo.fromPlatform();
if (mounted) {
showDialog(
context: this,
builder: (context) => AlertDialog(
content: Column(
mainAxisSize: .min,
spacing: 16,
children: [
Row(
spacing: 12,
children: [
SvgPicture.asset("assets/bundled/icon.svg", width: 64),
Expanded(
child: Column(
crossAxisAlignment: .start,
children: [
Wrap(
crossAxisAlignment: .center,
spacing: 4,
children: [
Text(
"Nexus",
style: Theme.of(context).textTheme.headlineMedium,
),
Text(
"(${packageInfo.version}+${const String.fromEnvironment("GIT_COMMIT", defaultValue: "dev")})",
),
],
),
Text(
"A simple and user-friendly Matrix client",
overflow: .ellipsis,
style: Theme.of(context).textTheme.titleMedium,
),
],
),
),
],
),
M3ECardColumn(
onTap: (index) =>
ref.read(LaunchHelper.provider).launchUrl(switch (index) {
0 => .https("git.federated.nexus", "nexus/nexus"),
_ => .https("liberapay.com", "QuadRadical"),
}),
children: [
ListTile(
leading: Icon(Icons.commit),
title: Text("Source Code"),
),
ListTile(
leading: Icon(Icons.favorite, color: Colors.pinkAccent),
title: Text("Donate"),
),
],
),
],
),
showAdaptiveSheet(
(context) => SheetLayout(
actions: [
TextButton(
onPressed: () => showLicensePage(context: context),
@ -78,6 +24,65 @@ extension ShowAboutDialog on BuildContext {
child: Text("Close"),
),
],
children: [
Column(
mainAxisSize: .min,
spacing: 16,
children: [
Row(
spacing: 12,
children: [
SvgPicture.asset("assets/bundled/icon.svg", width: 64),
Expanded(
child: Column(
crossAxisAlignment: .start,
children: [
Wrap(
crossAxisAlignment: .center,
spacing: 4,
children: [
Text(
"Nexus",
style: Theme.of(context)
.textTheme
.headlineMedium,
),
Text(
"(${packageInfo.version}+${const String.fromEnvironment("GIT_COMMIT", defaultValue: "dev")})",
),
],
),
Text(
"A simple and user-friendly Matrix client",
overflow: .ellipsis,
style: Theme.of(context).textTheme.titleMedium,
),
],
),
),
],
),
M3ECardColumn(
onTap: (index) =>
ref.read(LaunchHelper.provider).launchUrl(switch (index) {
0 => .https("git.federated.nexus", "nexus/nexus"),
_ => .https("liberapay.com", "QuadRadical"),
}),
children: [
ListTile(
leading: Icon(Icons.commit),
title: Text("Source Code"),
),
ListTile(
leading: Icon(Icons.favorite, color: Colors.pinkAccent),
title: Text("Donate"),
),
],
),
],
),
],
),
);
}