mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 23:08:59 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -28,8 +28,10 @@ void main() {
|
||||
});
|
||||
|
||||
if (unsplashAccessKey.isEmpty) {
|
||||
Logger('main').severe('Unsplash Access Key is required. '
|
||||
'Please add to `lib/unsplash_access_key.dart`.');
|
||||
Logger('main').severe(
|
||||
'Unsplash Access Key is required. '
|
||||
'Please add to `lib/unsplash_access_key.dart`.',
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -37,9 +39,8 @@ void main() {
|
||||
|
||||
runApp(
|
||||
ChangeNotifierProvider<PhotoSearchModel>(
|
||||
create: (context) => PhotoSearchModel(
|
||||
Unsplash(accessKey: unsplashAccessKey),
|
||||
),
|
||||
create:
|
||||
(context) => PhotoSearchModel(Unsplash(accessKey: unsplashAccessKey)),
|
||||
child: const UnsplashSearchApp(),
|
||||
),
|
||||
);
|
||||
@@ -75,46 +76,54 @@ class UnsplashHomePage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final photoSearchModel = Provider.of<PhotoSearchModel>(context);
|
||||
menubar.setApplicationMenu([
|
||||
menubar.NativeSubmenu(label: 'Search', children: [
|
||||
menubar.NativeMenuItem(
|
||||
label: 'Search…',
|
||||
onSelected: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
PhotoSearchDialog(callback: photoSearchModel.addSearch),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (!Platform.isMacOS)
|
||||
menubar.NativeSubmenu(
|
||||
label: 'Search',
|
||||
children: [
|
||||
menubar.NativeMenuItem(
|
||||
label: 'Quit',
|
||||
label: 'Search…',
|
||||
onSelected: () {
|
||||
SystemNavigator.pop();
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder:
|
||||
(context) =>
|
||||
PhotoSearchDialog(callback: photoSearchModel.addSearch),
|
||||
);
|
||||
},
|
||||
),
|
||||
]),
|
||||
menubar.NativeSubmenu(label: 'About', children: [
|
||||
menubar.NativeMenuItem(
|
||||
label: 'About',
|
||||
onSelected: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => const PolicyDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
])
|
||||
if (!Platform.isMacOS)
|
||||
menubar.NativeMenuItem(
|
||||
label: 'Quit',
|
||||
onSelected: () {
|
||||
SystemNavigator.pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
menubar.NativeSubmenu(
|
||||
label: 'About',
|
||||
children: [
|
||||
menubar.NativeMenuItem(
|
||||
label: 'About',
|
||||
onSelected: () {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => const PolicyDialog(),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
]);
|
||||
|
||||
return UnsplashNotice(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: photoSearchModel.entries.isNotEmpty
|
||||
? const UnsplashSearchContent()
|
||||
: const Center(
|
||||
child: Text('Search for Photos using the Search menu'),
|
||||
),
|
||||
child:
|
||||
photoSearchModel.entries.isNotEmpty
|
||||
? const UnsplashSearchContent()
|
||||
: const Center(
|
||||
child: Text('Search for Photos using the Search menu'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user