Skip to content

Commit 41c3fd1

Browse files
authored
Merge pull request #12 from Drakonov/main
Add alwaysShowTitle property
2 parents 9350281 + 8ebbf6a commit 41c3fd1

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/draggable_home.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
library draggable_home;
22

3-
import 'package:flutter/foundation.dart';
43
import 'package:flutter/material.dart';
54
import 'package:rxdart/rxdart.dart';
65

@@ -23,6 +22,9 @@ class DraggableHome extends StatefulWidget {
2322
/// Always Show Leading And Action : This make Leading and Action always visible. Default value is false.
2423
final bool alwaysShowLeadingAndAction;
2524

25+
/// Always Show Title : This make Title always visible. Default value is false.
26+
final bool alwaysShowTitle;
27+
2628
/// Drawer: Drawers are typically used with the Scaffold.drawer property.
2729
final Widget? drawer;
2830

@@ -84,6 +86,7 @@ class DraggableHome extends StatefulWidget {
8486
this.centerTitle = true,
8587
this.actions,
8688
this.alwaysShowLeadingAndAction = false,
89+
this.alwaysShowTitle = false,
8790
this.headerExpandedHeight = 0.35,
8891
required this.headerWidget,
8992
this.headerBottomBar,
@@ -202,11 +205,15 @@ class _DraggableHomeState extends State<DraggableHome> {
202205
title: StreamBuilder<bool>(
203206
stream: null,
204207
builder: (context, snapshot) {
205-
return AnimatedOpacity(
206-
opacity: streams[0] ? 1 : 0,
207-
duration: Duration(milliseconds: 100),
208-
child: widget.title,
209-
);
208+
if (widget.alwaysShowTitle) {
209+
return widget.title;
210+
} else {
211+
return AnimatedOpacity(
212+
opacity: streams[0] ? 1 : 0,
213+
duration: Duration(milliseconds: 100),
214+
child: widget.title,
215+
);
216+
}
210217
},
211218
),
212219
collapsedHeight: appBarHeight,

0 commit comments

Comments
 (0)