Add adaptive popup helpers: anchored choice menus and details dialogs
Phase 2b.1 of docs/plans/floating-windows.md. showAppChoiceMenu is a menu panel anchored to its button on a wide app and a bottom sheet on a phone; showAppDetails is a dialog or a bottom sheet. Both are on the root navigator, and the app's width decides, so content in a narrow floating window still gets desktop popups. The probe window exercises both.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/app_popups.dart';
|
||||
import 'package:pipelines_app/shell/windows/window_entry.dart';
|
||||
import 'package:pipelines_app/shell/windows/window_kind.dart';
|
||||
import 'package:pipelines_app/shell/windows/window_manager.dart';
|
||||
@@ -88,6 +89,34 @@ class ProbeContentState extends State<ProbeContent> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Builder(
|
||||
builder: (anchor) => _button('choice', () async {
|
||||
final value = await showAppChoiceMenu<String>(
|
||||
anchor,
|
||||
builder: (menu) => Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (final choice in const ['Choice one', 'Choice two'])
|
||||
ListTile(
|
||||
title: Text(choice),
|
||||
onTap: () => Navigator.of(menu).pop(choice),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (mounted && value != null) setState(() => picked = value);
|
||||
}),
|
||||
),
|
||||
_button(
|
||||
'details',
|
||||
() => showAppDetails<void>(
|
||||
context,
|
||||
builder: (_) => const Padding(
|
||||
padding: EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
child: Text('Details body'),
|
||||
),
|
||||
),
|
||||
),
|
||||
_button(
|
||||
'dialog',
|
||||
() => showDialog<void>(
|
||||
|
||||
Reference in New Issue
Block a user