|
@@ -2,10 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:sport/widgets/image.dart';
|
|
|
|
|
|
-import 'misc.dart';
|
|
|
-
|
|
|
-const titleStyle = TextStyle(
|
|
|
- fontWeight: FontWeight.w600, fontSize: 18.0, color: Color(0xff333333));
|
|
|
+const titleStyle = TextStyle(fontWeight: FontWeight.w600, fontSize: 18.0, color: Color(0xff333333));
|
|
|
|
|
|
Widget buildSliverAppBar(BuildContext context, String title,
|
|
|
{List<Widget> actions,
|
|
@@ -18,12 +15,11 @@ Widget buildSliverAppBar(BuildContext context, String title,
|
|
|
brightness = -1,
|
|
|
textStyle = titleStyle,
|
|
|
whiteBackButton = false,
|
|
|
- pinned = true}) {
|
|
|
+ pinned = true,
|
|
|
+ EdgeInsets padding = const EdgeInsets.fromLTRB(12.0, 0, 0, 15.0)}) {
|
|
|
return SliverAppBar(
|
|
|
pinned: pinned,
|
|
|
- brightness: brightness == -1
|
|
|
- ? null
|
|
|
- : brightness == 1 ? Brightness.dark : Brightness.light,
|
|
|
+ brightness: brightness == -1 ? null : brightness == 1 ? Brightness.dark : Brightness.light,
|
|
|
expandedHeight: height,
|
|
|
backgroundColor: backgroundColor,
|
|
|
forceElevated: innerBoxIsScrolled,
|
|
@@ -45,33 +41,25 @@ Widget buildSliverAppBar(BuildContext context, String title,
|
|
|
)
|
|
|
: whiteBackButton
|
|
|
? IconButton(
|
|
|
- icon:
|
|
|
- Image.asset("lib/assets/img/topbar_return_white.png"),
|
|
|
+ icon: Image.asset("lib/assets/img/topbar_return_white.png"),
|
|
|
onPressed: () {
|
|
|
Navigator.of(context).pop();
|
|
|
},
|
|
|
)
|
|
|
: Container(),
|
|
|
actions: actions,
|
|
|
- flexibleSpace: buildFlexibleSpace(title,
|
|
|
- paddingLeading: paddingLeading, textStyle: textStyle));
|
|
|
+ flexibleSpace: _buildFlexibleSpace(title, paddingLeading: paddingLeading, textStyle: textStyle, padding: padding));
|
|
|
}
|
|
|
|
|
|
-Widget buildFlexibleSpace(
|
|
|
- String title, {
|
|
|
- paddingLeading = true,
|
|
|
- textStyle = titleStyle,
|
|
|
-}) {
|
|
|
+Widget _buildFlexibleSpace(String title, {paddingLeading = true, textStyle = titleStyle, EdgeInsets padding}) {
|
|
|
return LayoutBuilder(builder: (context, box) {
|
|
|
- final FlexibleSpaceBarSettings settings =
|
|
|
- context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
|
|
|
+ final FlexibleSpaceBarSettings settings = context.dependOnInheritedWidgetOfExactType<FlexibleSpaceBarSettings>();
|
|
|
return FlexibleSpaceBar(
|
|
|
centerTitle: false,
|
|
|
- titlePadding: EdgeInsets.fromLTRB(12.0, 0, 0, 15.0),
|
|
|
+ titlePadding: padding,
|
|
|
title: paddingLeading
|
|
|
? Padding(
|
|
|
- padding: EdgeInsets.only(
|
|
|
- left: (settings.maxExtent - box.biggest.height) / 3 * 1.6,bottom: .5),
|
|
|
+ padding: EdgeInsets.only(left: (settings.maxExtent - box.biggest.height) / 3 * 1.6, bottom: .5),
|
|
|
child: Text(
|
|
|
title,
|
|
|
style: textStyle,
|
|
@@ -85,14 +73,11 @@ Widget buildFlexibleSpace(
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-Widget buildActionButton(String title, VoidCallback onPressed,
|
|
|
- {Color textColor}) {
|
|
|
+Widget buildActionButton(String title, VoidCallback onPressed, {Color textColor}) {
|
|
|
return IconButton(
|
|
|
icon: Text(
|
|
|
title,
|
|
|
- style: textColor != null
|
|
|
- ? TextStyle(fontSize: 16.0, color: textColor)
|
|
|
- : TextStyle(fontSize: 16),
|
|
|
+ style: textColor != null ? TextStyle(fontSize: 16.0, color: textColor) : TextStyle(fontSize: 16),
|
|
|
),
|
|
|
onPressed: onPressed,
|
|
|
);
|
|
@@ -111,10 +96,12 @@ Widget buildAppBar(BuildContext context, {String title, List<Widget> actions}) {
|
|
|
return AppBar(
|
|
|
titleSpacing: -16.0,
|
|
|
centerTitle: false,
|
|
|
- title: title == null ? null : Text(
|
|
|
- "$title",
|
|
|
- style: titleStyle,
|
|
|
- ),
|
|
|
+ title: title == null
|
|
|
+ ? null
|
|
|
+ : Text(
|
|
|
+ "$title",
|
|
|
+ style: titleStyle,
|
|
|
+ ),
|
|
|
leading: buildBackButton(context),
|
|
|
actions: actions,
|
|
|
);
|