Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 640a8cb

Browse files
authored
chore: Introduce the NotImplementedDialog (#70)
1 parent 874f2e9 commit 640a8cb

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import 'package:flutter/material.dart';
2+
3+
/// A very simple dialog to indicate that something was not implemented yet.
4+
///
5+
/// Show it like this:
6+
/// ```dart
7+
/// onPressed: () {
8+
/// NotImplementedDialog.show(context);
9+
/// // Or:
10+
/// context.notImplementedYet();
11+
/// },
12+
/// ```
13+
class NotImplementedDialog extends StatelessWidget {
14+
const NotImplementedDialog._({Key? key}) : super(key: key);
15+
16+
static Future<void> show(BuildContext context) {
17+
return showDialog(
18+
context: context,
19+
builder: (context) => const NotImplementedDialog._(),
20+
);
21+
}
22+
23+
@override
24+
Widget build(BuildContext context) {
25+
return AlertDialog(
26+
title: const Text('Not implemented yet'),
27+
content: const Text('This was not implemented yet!'),
28+
actions: [
29+
TextButton(
30+
onPressed: Navigator.of(context).pop,
31+
child: const Text('OK'),
32+
)
33+
],
34+
);
35+
}
36+
}
37+
38+
extension NotImplementedDialogBuildContextExtension on BuildContext {
39+
/// Displays a [NotImplementedDialog].
40+
Future<void> notImplementedYet() => NotImplementedDialog.show(this);
41+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /