1
0
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:
Eric Windmill
2025-02-12 18:08:01 -05:00
committed by GitHub
parent d62c784789
commit 719fd72c38
685 changed files with 76244 additions and 53721 deletions

View File

@@ -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'),
),
),
);
}