Skip to content

Commit 47e6cfc

Browse files
committed
Version bump and format
1 parent 9b7f559 commit 47e6cfc

File tree

1,204 files changed

+35450
-35561
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,204 files changed

+35450
-35561
lines changed

adaptive_app/step_03/lib/main.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class ResizeablePage extends StatelessWidget {
5151
_fillTableRow(
5252
context: context,
5353
property: 'Window Size',
54-
value: '${mediaQuery.size.width.toStringAsFixed(1)} x '
54+
value:
55+
'${mediaQuery.size.width.toStringAsFixed(1)} x '
5556
'${mediaQuery.size.height.toStringAsFixed(1)}',
5657
),
5758
_fillTableRow(
@@ -78,10 +79,11 @@ class ResizeablePage extends StatelessWidget {
7879
);
7980
}
8081

81-
TableRow _fillTableRow(
82-
{required BuildContext context,
83-
required String property,
84-
required String value}) {
82+
TableRow _fillTableRow({
83+
required BuildContext context,
84+
required String property,
85+
required String value,
86+
}) {
8587
return TableRow(
8688
children: [
8789
TableCell(

adaptive_app/step_03/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1919
version: 1.0.0+1
2020

2121
environment:
22-
sdk: ^3.6.0-0
22+
sdk: ^3.7.0-0
2323

2424
# Dependencies specify other packages that your package needs in order to work.
2525
# To automatically upgrade your package dependencies to the latest versions

adaptive_app/step_04/lib/main.dart

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ final _router = GoRouter(
3232
builder: (context, state) {
3333
final title = state.uri.queryParameters['title']!;
3434
final id = state.pathParameters['id']!;
35-
return PlaylistDetails(
36-
playlistId: id,
37-
playlistName: title,
38-
);
35+
return PlaylistDetails(playlistId: id, playlistName: title);
3936
},
4037
),
4138
],
@@ -49,13 +46,16 @@ void main() {
4946
exit(1);
5047
}
5148

52-
runApp(ChangeNotifierProvider<FlutterDevPlaylists>(
53-
create: (context) => FlutterDevPlaylists(
54-
flutterDevAccountId: flutterDevAccountId,
55-
youTubeApiKey: youTubeApiKey,
49+
runApp(
50+
ChangeNotifierProvider<FlutterDevPlaylists>(
51+
create:
52+
(context) => FlutterDevPlaylists(
53+
flutterDevAccountId: flutterDevAccountId,
54+
youTubeApiKey: youTubeApiKey,
55+
),
56+
child: const PlaylistsApp(),
5657
),
57-
child: const PlaylistsApp(),
58-
));
58+
);
5959
}
6060

6161
class PlaylistsApp extends StatelessWidget {
@@ -65,14 +65,16 @@ class PlaylistsApp extends StatelessWidget {
6565
Widget build(BuildContext context) {
6666
return MaterialApp.router(
6767
title: 'FlutterDev Playlists',
68-
theme: FlexColorScheme.light(
69-
scheme: FlexScheme.red,
70-
useMaterial3: true,
71-
).toTheme,
72-
darkTheme: FlexColorScheme.dark(
73-
scheme: FlexScheme.red,
74-
useMaterial3: true,
75-
).toTheme,
68+
theme:
69+
FlexColorScheme.light(
70+
scheme: FlexScheme.red,
71+
useMaterial3: true,
72+
).toTheme,
73+
darkTheme:
74+
FlexColorScheme.dark(
75+
scheme: FlexScheme.red,
76+
useMaterial3: true,
77+
).toTheme,
7678
themeMode: ThemeMode.dark, // Or ThemeMode.System if you'd prefer
7779
debugShowCheckedModeBanner: false,
7880
routerConfig: _router,

adaptive_app/step_04/lib/src/app_state.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ class FlutterDevPlaylists extends ChangeNotifier {
1313
required String flutterDevAccountId,
1414
required String youTubeApiKey,
1515
}) : _flutterDevAccountId = flutterDevAccountId {
16-
_api = YouTubeApi(
17-
_ApiKeyClient(
18-
client: http.Client(),
19-
key: youTubeApiKey,
20-
),
21-
);
16+
_api = YouTubeApi(_ApiKeyClient(client: http.Client(), key: youTubeApiKey));
2217
_loadPlaylists();
2318
}
2419

@@ -34,9 +29,11 @@ class FlutterDevPlaylists extends ChangeNotifier {
3429
pageToken: nextPageToken,
3530
);
3631
_playlists.addAll(response.items!);
37-
_playlists.sort((a, b) => a.snippet!.title!
38-
.toLowerCase()
39-
.compareTo(b.snippet!.title!.toLowerCase()));
32+
_playlists.sort(
33+
(a, b) => a.snippet!.title!.toLowerCase().compareTo(
34+
b.snippet!.title!.toLowerCase(),
35+
),
36+
);
4037
notifyListeners();
4138
nextPageToken = response.nextPageToken;
4239
} while (nextPageToken != null);
@@ -84,10 +81,12 @@ class _ApiKeyClient extends http.BaseClient {
8481

8582
@override
8683
Future<http.StreamedResponse> send(http.BaseRequest request) {
87-
final url = request.url.replace(queryParameters: <String, List<String>>{
88-
...request.url.queryParametersAll,
89-
'key': [key]
90-
});
84+
final url = request.url.replace(
85+
queryParameters: <String, List<String>>{
86+
...request.url.queryParametersAll,
87+
'key': [key],
88+
},
89+
);
9190

9291
return client.send(http.Request(request.method, url));
9392
}

adaptive_app/step_04/lib/src/playlist_details.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,18 @@ import 'package:url_launcher/link.dart';
1010
import 'app_state.dart';
1111

1212
class PlaylistDetails extends StatelessWidget {
13-
const PlaylistDetails(
14-
{required this.playlistId, required this.playlistName, super.key});
13+
const PlaylistDetails({
14+
required this.playlistId,
15+
required this.playlistName,
16+
super.key,
17+
});
1518
final String playlistId;
1619
final String playlistName;
1720

1821
@override
1922
Widget build(BuildContext context) {
2023
return Scaffold(
21-
appBar: AppBar(
22-
title: Text(playlistName),
23-
),
24+
appBar: AppBar(title: Text(playlistName)),
2425
body: Consumer<FlutterDevPlaylists>(
2526
builder: (context, playlists, _) {
2627
final playlistItems = playlists.playlistItems(playlistId: playlistId);
@@ -70,10 +71,7 @@ class _PlaylistDetailsListView extends StatelessWidget {
7071
child: DecoratedBox(
7172
decoration: BoxDecoration(
7273
gradient: LinearGradient(
73-
colors: [
74-
Colors.transparent,
75-
Theme.of(context).colorScheme.surface,
76-
],
74+
colors: [Colors.transparent, Theme.of(context).colorScheme.surface],
7775
begin: Alignment.topCenter,
7876
end: Alignment.bottomCenter,
7977
stops: const [0.5, 0.95],
@@ -84,7 +82,9 @@ class _PlaylistDetailsListView extends StatelessWidget {
8482
}
8583

8684
Widget _buildTitleAndSubtitle(
87-
BuildContext context, PlaylistItem playlistItem) {
85+
BuildContext context,
86+
PlaylistItem playlistItem,
87+
) {
8888
return Positioned(
8989
left: 20,
9090
right: 0,
@@ -96,16 +96,16 @@ class _PlaylistDetailsListView extends StatelessWidget {
9696
Text(
9797
playlistItem.snippet!.title!,
9898
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
99-
fontSize: 18,
100-
// fontWeight: FontWeight.bold,
101-
),
99+
fontSize: 18,
100+
// fontWeight: FontWeight.bold,
101+
),
102102
),
103103
if (playlistItem.snippet!.videoOwnerChannelTitle != null)
104104
Text(
105105
playlistItem.snippet!.videoOwnerChannelTitle!,
106-
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
107-
fontSize: 12,
108-
),
106+
style: Theme.of(
107+
context,
108+
).textTheme.bodyMedium!.copyWith(fontSize: 12),
109109
),
110110
],
111111
),
@@ -121,20 +121,20 @@ class _PlaylistDetailsListView extends StatelessWidget {
121121
height: 42,
122122
decoration: const BoxDecoration(
123123
color: Colors.white,
124-
borderRadius: BorderRadius.all(
125-
Radius.circular(21),
126-
),
124+
borderRadius: BorderRadius.all(Radius.circular(21)),
127125
),
128126
),
129127
Link(
130128
uri: Uri.parse(
131-
'https://www.youtube.com/watch?v=${playlistItem.snippet!.resourceId!.videoId}'),
132-
builder: (context, followLink) => IconButton(
133-
onPressed: followLink,
134-
color: Colors.red,
135-
icon: const Icon(Icons.play_circle_fill),
136-
iconSize: 45,
129+
'https://www.youtube.com/watch?v=${playlistItem.snippet!.resourceId!.videoId}',
137130
),
131+
builder:
132+
(context, followLink) => IconButton(
133+
onPressed: followLink,
134+
color: Colors.red,
135+
icon: const Icon(Icons.play_circle_fill),
136+
iconSize: 45,
137+
),
138138
),
139139
],
140140
);

adaptive_app/step_04/lib/src/playlists.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ class Playlists extends StatelessWidget {
1515
@override
1616
Widget build(BuildContext context) {
1717
return Scaffold(
18-
appBar: AppBar(
19-
title: const Text('FlutterDev Playlists'),
20-
),
18+
appBar: AppBar(title: const Text('FlutterDev Playlists')),
2119
body: Consumer<FlutterDevPlaylists>(
2220
builder: (context, flutterDev, child) {
2321
final playlists = flutterDev.playlists;
2422
if (playlists.isEmpty) {
25-
return const Center(
26-
child: CircularProgressIndicator(),
27-
);
23+
return const Center(child: CircularProgressIndicator());
2824
}
2925

3026
return _PlaylistsListView(items: playlists);
@@ -52,15 +48,13 @@ class _PlaylistsListView extends StatelessWidget {
5248
playlist.snippet!.thumbnails!.default_!.url!,
5349
),
5450
title: Text(playlist.snippet!.title!),
55-
subtitle: Text(
56-
playlist.snippet!.description!,
57-
),
51+
subtitle: Text(playlist.snippet!.description!),
5852
onTap: () {
5953
context.go(
6054
Uri(
6155
path: '/playlist/${playlist.id}',
6256
queryParameters: <String, String>{
63-
'title': playlist.snippet!.title!
57+
'title': playlist.snippet!.title!,
6458
},
6559
).toString(),
6660
);

adaptive_app/step_04/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1919
version: 1.0.0+1
2020

2121
environment:
22-
sdk: ^3.6.0-0
22+
sdk: ^3.7.0-0
2323

2424
# Dependencies specify other packages that your package needs in order to work.
2525
# To automatically upgrade your package dependencies to the latest versions

adaptive_app/step_05/lib/main.dart

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ final _router = GoRouter(
3434
final id = state.pathParameters['id']!;
3535
return Scaffold(
3636
appBar: AppBar(title: Text(title)),
37-
body: PlaylistDetails(
38-
playlistId: id,
39-
playlistName: title,
40-
),
37+
body: PlaylistDetails(playlistId: id, playlistName: title),
4138
);
4239
},
4340
),
@@ -52,13 +49,16 @@ void main() {
5249
exit(1);
5350
}
5451

55-
runApp(ChangeNotifierProvider<FlutterDevPlaylists>(
56-
create: (context) => FlutterDevPlaylists(
57-
flutterDevAccountId: flutterDevAccountId,
58-
youTubeApiKey: youTubeApiKey,
52+
runApp(
53+
ChangeNotifierProvider<FlutterDevPlaylists>(
54+
create:
55+
(context) => FlutterDevPlaylists(
56+
flutterDevAccountId: flutterDevAccountId,
57+
youTubeApiKey: youTubeApiKey,
58+
),
59+
child: const PlaylistsApp(),
5960
),
60-
child: const PlaylistsApp(),
61-
));
61+
);
6262
}
6363

6464
class PlaylistsApp extends StatelessWidget {
@@ -68,14 +68,16 @@ class PlaylistsApp extends StatelessWidget {
6868
Widget build(BuildContext context) {
6969
return MaterialApp.router(
7070
title: 'FlutterDev Playlists',
71-
theme: FlexColorScheme.light(
72-
scheme: FlexScheme.red,
73-
useMaterial3: true,
74-
).toTheme,
75-
darkTheme: FlexColorScheme.dark(
76-
scheme: FlexScheme.red,
77-
useMaterial3: true,
78-
).toTheme,
71+
theme:
72+
FlexColorScheme.light(
73+
scheme: FlexScheme.red,
74+
useMaterial3: true,
75+
).toTheme,
76+
darkTheme:
77+
FlexColorScheme.dark(
78+
scheme: FlexScheme.red,
79+
useMaterial3: true,
80+
).toTheme,
7981
themeMode: ThemeMode.dark, // Or ThemeMode.System if you'd prefer
8082
debugShowCheckedModeBanner: false,
8183
routerConfig: _router,

adaptive_app/step_05/lib/src/adaptive_playlists.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class NarrowDisplayPlaylists extends StatelessWidget {
4141
Uri(
4242
path: '/playlist/${playlist.id}',
4343
queryParameters: <String, String>{
44-
'title': playlist.snippet!.title!
44+
'title': playlist.snippet!.title!,
4545
},
4646
).toString(),
4747
);
@@ -72,14 +72,18 @@ class _WideDisplayPlaylistsState extends State<WideDisplayPlaylists> {
7272
body: SplitView(
7373
viewMode: SplitViewMode.Horizontal,
7474
children: [
75-
Playlists(playlistSelected: (playlist) {
76-
setState(() {
77-
selectedPlaylist = playlist;
78-
});
79-
}),
75+
Playlists(
76+
playlistSelected: (playlist) {
77+
setState(() {
78+
selectedPlaylist = playlist;
79+
});
80+
},
81+
),
8082
switch ((selectedPlaylist?.id, selectedPlaylist?.snippet?.title)) {
81-
(String id, String title) =>
82-
PlaylistDetails(playlistId: id, playlistName: title),
83+
(String id, String title) => PlaylistDetails(
84+
playlistId: id,
85+
playlistName: title,
86+
),
8387
_ => const Center(child: Text('Select a playlist')),
8488
},
8589
],

0 commit comments

Comments
 (0)