Adapt remaining feature popups for desktop
Use the shared anchored choices and bounded details dialogs for diff form and artifact facts while preserving narrow Material sheets. Cover both width branches and dismissal behavior.
This commit is contained in:
@@ -2,6 +2,8 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
|
||||
enum DiffForm { rendered, raw }
|
||||
|
||||
const diffFormLabels = <DiffForm, String>{
|
||||
@@ -48,7 +50,7 @@ Widget diffFormControl(
|
||||
);
|
||||
}
|
||||
|
||||
/// Native action sheet/bottom sheet when fixed segment labels cannot fit.
|
||||
/// An anchored desktop menu or narrow sheet when segment labels cannot fit.
|
||||
Widget diffFormMenu(
|
||||
BuildContext context, {
|
||||
required DiffForm form,
|
||||
@@ -59,9 +61,8 @@ Widget diffFormMenu(
|
||||
constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
|
||||
padding: EdgeInsets.zero,
|
||||
icon: const Icon(Icons.more_vert, size: 28),
|
||||
onPressed: () => showModalBottomSheet<void>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
onPressed: () => showAppChoiceMenu<void>(
|
||||
context,
|
||||
builder: (sheetContext) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -77,13 +78,13 @@ Widget diffFormMenu(
|
||||
),
|
||||
),
|
||||
for (final entry in diffFormLabels.entries)
|
||||
ListTile(
|
||||
title: Text(entry.value),
|
||||
AppChoiceMenuItem(
|
||||
selected: entry.key == form,
|
||||
onTap: () {
|
||||
Navigator.of(sheetContext).pop();
|
||||
onChanged(entry.key);
|
||||
},
|
||||
child: Text(entry.value),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user