Skip to content

Commit

Permalink
Enhance theme example
Browse files Browse the repository at this point in the history
  • Loading branch information
mono0926 committed Nov 14, 2023
1 parent 6e85407 commit 1b055f4
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions example/lib/pages/alert_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:adaptive_dialog/adaptive_dialog.dart';
import 'package:example/router/router.dart';
import 'package:example/util/logger.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

Expand Down Expand Up @@ -89,27 +90,6 @@ class AlertPage extends StatelessWidget {
logger.info(result);
},
),
ListTile(
title: const Text('OK Dialog (Theme builder)'),
onTap: () async {
final result = await showOkAlertDialog(
context: context,
title: 'Title',
message: 'This is message.',
builder: (context, child) => Theme(
data: ThemeData(
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: Colors.orange,
),
),
),
child: child,
),
);
logger.info(result);
},
),
ListTile(
title: const Text('OK/Cancel Dialog'),
onTap: () async {
Expand All @@ -133,14 +113,31 @@ class AlertPage extends StatelessWidget {
logger.info(result);
},
),
const ListTile(
title: Text('OK/Cancel Dialog (Destructive)'),
),
ListTile(
title: const Text('OK/Cancel Dialog (Destructive)'),
title: const Text('OK/Cancel Dialog (Theme builder)'),
onTap: () async {
final result = await showOkCancelAlertDialog(
context: context,
title: 'Title',
message: 'This is message.',
isDestructiveAction: true,
builder: (context, child) => Theme(
data: ThemeData(
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
foregroundColor: Colors.orange,
),
),
// If this is commented out, the color for cupertino will be default blue/red.
cupertinoOverrideTheme: const CupertinoThemeData(
primaryColor: Colors.purple,
),
),
child: child,
),
);
logger.info(result);
},
Expand Down

0 comments on commit 1b055f4

Please sign in to comment.