Skip to content

Commit b4c197b

Browse files
style: dart format entire repo (example/ files missed in previous commit)
1 parent e61dc6a commit b4c197b

4 files changed

Lines changed: 148 additions & 68 deletions

File tree

example/lib/main.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ class DemoHomePage extends StatelessWidget {
130130
subtitle:
131131
'Full e-book solution with paged mode, themes, and library management',
132132
color: Colors.deepPurple,
133-
onTap: () => Navigator.push(
134-
context, MaterialPageRoute(builder: (_) => const LibraryScreen())),
133+
onTap: () => Navigator.push(context,
134+
MaterialPageRoute(builder: (_) => const LibraryScreen())),
135135
),
136136
// ── Layout ────────────────────────────────────────────────────────
137137
_buildSectionHeader(context, 'Layout'),
@@ -3110,7 +3110,6 @@ class VideoDemo extends StatelessWidget {
31103110
</video>
31113111
''',
31123112
onLinkTap: (url) async {
3113-
31143113
final uri = Uri.tryParse(url);
31153114
if (uri != null && await canLaunchUrl(uri)) {
31163115
await launchUrl(uri, mode: LaunchMode.platformDefault);
@@ -3133,7 +3132,6 @@ class VideoDemo extends StatelessWidget {
31333132
</video>
31343133
''',
31353134
onLinkTap: (url) async {
3136-
31373135
final uri = Uri.tryParse(url);
31383136
if (uri != null && await canLaunchUrl(uri)) {
31393137
await launchUrl(uri, mode: LaunchMode.platformDefault);
@@ -3175,7 +3173,6 @@ class VideoDemo extends StatelessWidget {
31753173
</div>
31763174
''',
31773175
onLinkTap: (url) async {
3178-
31793176
final uri = Uri.tryParse(url);
31803177
if (uri != null && await canLaunchUrl(uri)) {
31813178
await launchUrl(uri, mode: LaunchMode.platformDefault);
@@ -3218,7 +3215,6 @@ class VideoDemo extends StatelessWidget {
32183215
''',
32193216
selectable: true,
32203217
onLinkTap: (url) async {
3221-
32223218
final uri = Uri.tryParse(url);
32233219
if (uri != null && await canLaunchUrl(uri)) {
32243220
await launchUrl(uri, mode: LaunchMode.platformDefault);

example/lib/reader_app/book_model.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Book {
88
final String content;
99
final BookType type;
1010
final String? description;
11-
11+
1212
// Persistent fields - marked as final for immutability where possible
1313
final int lastPage;
1414
final bool isBookmarked;

example/lib/reader_app/library_screen.dart

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ class _LibraryScreenState extends State<LibraryScreen> {
1515

1616
List<Book> get _filteredBooks {
1717
return MockLibrary.books.where((book) {
18-
final matchesSearch = book.title.toLowerCase().contains(_searchQuery.toLowerCase()) ||
19-
book.author.toLowerCase().contains(_searchQuery.toLowerCase());
18+
final matchesSearch =
19+
book.title.toLowerCase().contains(_searchQuery.toLowerCase()) ||
20+
book.author.toLowerCase().contains(_searchQuery.toLowerCase());
2021
final matchesBookmark = !_showOnlyBookmarked || book.isBookmarked;
2122
return matchesSearch && matchesBookmark;
2223
}).toList();
@@ -31,11 +32,15 @@ class _LibraryScreenState extends State<LibraryScreen> {
3132
body: CustomScrollView(
3233
slivers: [
3334
SliverAppBar.large(
34-
title: const Text('My Library', style: TextStyle(fontWeight: FontWeight.bold)),
35+
title: const Text('My Library',
36+
style: TextStyle(fontWeight: FontWeight.bold)),
3537
actions: [
3638
IconButton(
37-
icon: Icon(_showOnlyBookmarked ? Icons.bookmark : Icons.bookmark_border),
38-
onPressed: () => setState(() => _showOnlyBookmarked = !_showOnlyBookmarked),
39+
icon: Icon(_showOnlyBookmarked
40+
? Icons.bookmark
41+
: Icons.bookmark_border),
42+
onPressed: () =>
43+
setState(() => _showOnlyBookmarked = !_showOnlyBookmarked),
3944
),
4045
],
4146
),
@@ -58,13 +63,16 @@ class _LibraryScreenState extends State<LibraryScreen> {
5863
),
5964
),
6065
),
61-
62-
if (recentBooks.isNotEmpty && _searchQuery.isEmpty && !_showOnlyBookmarked) ...[
66+
67+
if (recentBooks.isNotEmpty &&
68+
_searchQuery.isEmpty &&
69+
!_showOnlyBookmarked) ...[
6370
const SliverToBoxAdapter(
6471
child: Padding(
6572
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 8),
66-
child: Text('Continue Reading',
67-
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
73+
child: Text('Continue Reading',
74+
style:
75+
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
6876
),
6977
),
7078
SliverToBoxAdapter(
@@ -86,8 +94,8 @@ class _LibraryScreenState extends State<LibraryScreen> {
8694
const SliverToBoxAdapter(
8795
child: Padding(
8896
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 16),
89-
child: Text('All Books',
90-
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
97+
child: Text('All Books',
98+
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
9199
),
92100
),
93101

@@ -99,7 +107,8 @@ class _LibraryScreenState extends State<LibraryScreen> {
99107
children: [
100108
Icon(Icons.library_books, size: 64, color: Colors.grey),
101109
SizedBox(height: 16),
102-
Text('No books found', style: TextStyle(color: Colors.grey)),
110+
Text('No books found',
111+
style: TextStyle(color: Colors.grey)),
103112
],
104113
),
105114
),
@@ -140,27 +149,32 @@ class _LibraryScreenState extends State<LibraryScreen> {
140149
color: Colors.white,
141150
borderRadius: BorderRadius.circular(16),
142151
boxShadow: [
143-
BoxShadow(color: Colors.black.withValues(alpha: 0.05), blurRadius: 10),
152+
BoxShadow(
153+
color: Colors.black.withValues(alpha: 0.05), blurRadius: 10),
144154
],
145155
),
146156
child: Row(
147157
children: [
148158
ClipRRect(
149159
borderRadius: BorderRadius.circular(8),
150-
child: Image.network(book.coverUrl, width: 80, height: 120, fit: BoxFit.cover),
160+
child: Image.network(book.coverUrl,
161+
width: 80, height: 120, fit: BoxFit.cover),
151162
),
152163
const SizedBox(width: 16),
153164
Expanded(
154165
child: Column(
155166
mainAxisAlignment: MainAxisAlignment.center,
156167
crossAxisAlignment: CrossAxisAlignment.start,
157168
children: [
158-
Text(book.title,
159-
style: const TextStyle(fontWeight: FontWeight.bold),
160-
maxLines: 2, overflow: TextOverflow.ellipsis),
161-
Text(book.author, style: const TextStyle(fontSize: 12, color: Colors.grey)),
169+
Text(book.title,
170+
style: const TextStyle(fontWeight: FontWeight.bold),
171+
maxLines: 2,
172+
overflow: TextOverflow.ellipsis),
173+
Text(book.author,
174+
style: const TextStyle(fontSize: 12, color: Colors.grey)),
162175
const Spacer(),
163-
const Text('Last read: 2 hours ago', style: TextStyle(fontSize: 10, color: Colors.grey)),
176+
const Text('Last read: 2 hours ago',
177+
style: TextStyle(fontSize: 10, color: Colors.grey)),
164178
const SizedBox(height: 4),
165179
ClipRRect(
166180
borderRadius: BorderRadius.circular(2),
@@ -206,7 +220,8 @@ class _LibraryScreenState extends State<LibraryScreen> {
206220
),
207221
if (book.isBookmarked)
208222
const Positioned(
209-
top: 8, right: 8,
223+
top: 8,
224+
right: 8,
210225
child: Icon(Icons.bookmark, color: Colors.amber, size: 28),
211226
),
212227
],

0 commit comments

Comments
 (0)