Skip to content

Commit f95dcba

Browse files
committed
fix: pixel line leak
1 parent 7a03bb1 commit f95dcba

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

example/lib/main.dart

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class HomePage extends StatelessWidget {
3535
],
3636
fullyStretchable: true,
3737
expandedBody: const CameraPreview(),
38+
backgroundColor: Colors.white,
39+
appBarColor: Colors.teal,
3840
);
3941
}
4042

@@ -52,13 +54,20 @@ class HomePage extends StatelessWidget {
5254
);
5355
}
5456

55-
Widget headerWidget(BuildContext context) => Center(
56-
child: Text("Title",
57-
style: Theme.of(context)
58-
.textTheme
59-
.headline2!
60-
.copyWith(color: Colors.white70)),
61-
);
57+
Widget headerWidget(BuildContext context) {
58+
return Container(
59+
color: Colors.blue,
60+
child: Center(
61+
child: Text(
62+
"Title",
63+
style: Theme.of(context)
64+
.textTheme
65+
.headline2!
66+
.copyWith(color: Colors.white70),
67+
),
68+
),
69+
);
70+
}
6271

6372
ListView listView() {
6473
return ListView.builder(

lib/draggable_home.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ class DraggableHome extends StatefulWidget {
4141
/// backgroundColor: The color of the Material widget that underlies the entire DraggableHome body.
4242
final Color? backgroundColor;
4343

44+
/// appBarColor: The color of the scaffold app bar.
45+
final Color? appBarColor;
46+
4447
/// curvedBodyRadius: Creates a border top left and top right radius of body, Default radius of the body is 20.0. For no radius simply set value to 0.
4548
final double curvedBodyRadius;
4649

@@ -91,6 +94,7 @@ class DraggableHome extends StatefulWidget {
9194
required this.headerWidget,
9295
this.headerBottomBar,
9396
this.backgroundColor,
97+
this.appBarColor,
9498
this.curvedBodyRadius = 20,
9599
required this.body,
96100
this.drawer,
@@ -182,14 +186,18 @@ class _DraggableHomeState extends State<DraggableHome> {
182186
physics: const BouncingScrollPhysics(),
183187
slivers: [
184188
StreamBuilder<List<bool>>(
185-
stream: CombineLatestStream.list<bool>(
186-
[isFullyCollapsed.stream, isFullyExpanded.stream]),
189+
stream: CombineLatestStream.list<bool>([
190+
isFullyCollapsed.stream,
191+
isFullyExpanded.stream,
192+
]),
187193
builder: (BuildContext context, AsyncSnapshot<List<bool>> snapshot) {
188194
final List<bool> streams = (snapshot.data ?? [false, false]);
189195
final bool fullyCollapsed = streams[0];
190196
final bool fullyExpanded = streams[1];
191197

192198
return SliverAppBar(
199+
backgroundColor:
200+
!fullyCollapsed ? widget.backgroundColor : widget.appBarColor,
193201
leading: widget.alwaysShowLeadingAndAction
194202
? widget.leading
195203
: !fullyCollapsed
@@ -218,6 +226,7 @@ class _DraggableHomeState extends State<DraggableHome> {
218226
children: [
219227
FlexibleSpaceBar(
220228
background: Container(
229+
margin: const EdgeInsets.only(bottom: 0.2),
221230
child: fullyExpanded
222231
? (widget.expandedBody ?? const SizedBox())
223232
: widget.headerWidget,

0 commit comments

Comments
 (0)