-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DialogTitle: don't hide 馃 properties with strings
Fixes #277
- Loading branch information
1 parent
e501a8e
commit be4ff50
Showing
3 changed files
with
116 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:yaru_widgets/yaru_widgets.dart'; | ||
|
||
class DialogPage extends StatefulWidget { | ||
const DialogPage({super.key}); | ||
|
||
@override | ||
State<DialogPage> createState() => _DialogPageState(); | ||
} | ||
|
||
class _DialogPageState extends State<DialogPage> { | ||
bool isCloseable = true; | ||
@override | ||
Widget build(BuildContext context) { | ||
return SizedBox( | ||
width: 400, | ||
child: Padding( | ||
padding: const EdgeInsets.all(kYaruPagePadding), | ||
child: Column( | ||
children: [ | ||
YaruTile( | ||
title: const Text('YaruDialogTitle'), | ||
trailing: OutlinedButton( | ||
onPressed: () => showDialog( | ||
barrierDismissible: isCloseable, | ||
context: context, | ||
builder: (context) { | ||
return AlertDialog( | ||
actions: [ | ||
if (!isCloseable) | ||
OutlinedButton( | ||
onPressed: () => Navigator.maybePop(context), | ||
child: Text( | ||
'Evil Force-Close', | ||
style: TextStyle( | ||
color: Theme.of(context).errorColor, | ||
), | ||
), | ||
) | ||
], | ||
titlePadding: EdgeInsets.zero, | ||
title: YaruDialogTitle( | ||
title: Row( | ||
mainAxisSize: MainAxisSize.min, | ||
children: const [ | ||
Text('The Title'), | ||
SizedBox( | ||
width: 10, | ||
), | ||
SizedBox( | ||
height: 25, | ||
child: YaruCircularProgressIndicator( | ||
strokeWidth: 3, | ||
), | ||
) | ||
], | ||
), | ||
isCloseable: isCloseable, | ||
), | ||
content: SizedBox( | ||
height: 100, | ||
child: YaruBanner( | ||
surfaceTintColor: Colors.pink, | ||
name: Text( | ||
isCloseable | ||
? 'You can close me' | ||
: 'You cannot close me', | ||
), | ||
subtitle: Text( | ||
isCloseable ? 'Please' : 'No way', | ||
), | ||
icon: Text( | ||
isCloseable ? '馃獰' : '馃拝', | ||
style: const TextStyle(fontSize: 30), | ||
), | ||
), | ||
), | ||
); | ||
}, | ||
), | ||
child: const Text('Open dialog'), | ||
), | ||
), | ||
YaruTile( | ||
title: const Text('isCloseable'), | ||
trailing: Switch( | ||
value: isCloseable, | ||
onChanged: (value) => setState(() => isCloseable = value), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters