Skip to content

Commit f0200c9

Browse files
committed
example app: add tooltip for presentation screen (overview)
1 parent f357390 commit f0200c9

File tree

4 files changed

+39
-16
lines changed

4 files changed

+39
-16
lines changed

example/lib/screens/horizontal_screen.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ class _HorizontalScreenState extends State<HorizontalScreen> {
4949
},
5050
onRefresh: () => Future.delayed(const Duration(seconds: 2)),
5151
child: ExampleHorizontalList(
52+
leading: const ListHelpBox(
53+
child: Text(
54+
'The indicator can be triggered from both sides. '
55+
'A button located on the app bar can be used to change the axis.',
56+
),
57+
),
5258
itemCount: 4,
5359
isHorizontal: _isHorizontal,
5460
),

example/lib/screens/presentation_screen.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,3 @@ class _PresentationScreenState extends State<PresentationScreen> {
238238
super.dispose();
239239
}
240240
}
241-

example/lib/widgets/example_app_bar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ExampleAppBar extends StatelessWidget implements PreferredSizeWidget {
1616
Widget build(BuildContext context) {
1717
return AppBar(
1818
title: Text(
19-
title ?? "flutter_custom_refresh_indicator",
19+
title ?? "custom_refresh_indicator",
2020
),
2121
actions: actions,
2222
elevation: elevation,

example/lib/widgets/example_list.dart

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,39 @@ class ExampleHorizontalList extends StatelessWidget {
165165
)
166166
],
167167
),
168-
child: ListView.builder(
169-
padding: const EdgeInsets.all(16),
170-
reverse: reverse,
171-
scrollDirection: isHorizontal ? Axis.horizontal : Axis.vertical,
172-
physics: const AlwaysScrollableScrollPhysics(
173-
parent: ClampingScrollPhysics(),
174-
),
175-
itemBuilder: (BuildContext context, int index) => const Padding(
176-
padding: EdgeInsets.all(16.0),
177-
child: AppCard(
178-
width: 300,
179-
height: 300,
168+
child: Column(
169+
children: [
170+
if (isHorizontal && leading != null) leading!,
171+
Expanded(
172+
child: CustomScrollView(
173+
reverse: reverse,
174+
scrollDirection: isHorizontal ? Axis.horizontal : Axis.vertical,
175+
physics: const AlwaysScrollableScrollPhysics(
176+
parent: ClampingScrollPhysics(),
177+
),
178+
slivers: [
179+
if (!isHorizontal && leading != null && !reverse)
180+
SliverToBoxAdapter(child: leading!),
181+
SliverPadding(
182+
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
183+
sliver: SliverList.separated(
184+
itemBuilder: (BuildContext context, int index) =>
185+
const AppCard(
186+
margin: EdgeInsets.zero,
187+
width: 300,
188+
height: 300,
189+
),
190+
itemCount: itemCount,
191+
separatorBuilder: (BuildContext context, int index) =>
192+
const SizedBox.square(dimension: 16),
193+
),
194+
),
195+
if (!isHorizontal && leading != null && reverse)
196+
SliverToBoxAdapter(child: leading!),
197+
],
198+
),
180199
),
181-
),
182-
itemCount: itemCount,
200+
],
183201
),
184202
);
185203
}

0 commit comments

Comments
 (0)