mirror of
https://codeberg.org/shroff/phylum.git
synced 2026-05-05 03:40:10 -05:00
25 lines
711 B
Dart
25 lines
711 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
Future showReponsiveDialog(BuildContext context, String title, WidgetBuilder builder) {
|
|
return showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
final width = MediaQuery.sizeOf(context).width;
|
|
if (width <= 600) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(title)),
|
|
body: SingleChildScrollView(child: builder(context)),
|
|
);
|
|
}
|
|
return AlertDialog(
|
|
title: Text(title),
|
|
scrollable: true,
|
|
content: SizedBox(width: 300, child: builder(context)),
|
|
actions: [
|
|
ElevatedButton(onPressed: Navigator.of(context).pop, child: Text('OK')),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|