Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 34 additions & 20 deletions examples/catalog_gallery/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ class CatalogGalleryApp extends StatefulWidget {
}

class _CatalogGalleryAppState extends State<CatalogGalleryApp> {

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
),
home: _CatalogGalleryHome(),
);
}
}

class _CatalogGalleryHome extends StatelessWidget {
_CatalogGalleryHome();

final catalog = CoreCatalogItems.asCatalog().copyWithout([
// Excluded, because they are flexible:
CoreCatalogItems.tabs,
Expand All @@ -31,28 +46,27 @@ class _CatalogGalleryAppState extends State<CatalogGalleryApp> {

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Catalog items that has "exampleData" field set'),
),
home: Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Catalog items that has "exampleData" field set'),
),
body: DebugCatalogView(
catalog: catalog,
onSubmit: (message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'User action: '
'${jsonEncode(message.parts.last)}',
),
body: DebugCatalogView(
catalog: catalog,
onSubmit: (message) {
final messageText = message.parts
.whereType<TextPart>()
.map((p) => p.text)
.lastOrNull;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'User action: '
'${jsonEncode(messageText)}',
),
);
},
),
),
);
},
),
);
}
Expand Down