4
2
Fork 0
frontend_flutter/lib/src/ui/widgets/top_bar.dart

56 lines
1.8 KiB
Dart
Raw Normal View History

2019-02-08 11:50:49 +08:00
import "package:flutter/material.dart";
import "search_input.dart";
2019-02-08 13:46:58 +08:00
class TopBar extends StatelessWidget {
final String logo = "assets/logo.png";
2019-06-27 10:06:07 +08:00
final SearchInput search;
final List<Widget> children;
final String title;
2019-02-08 11:50:49 +08:00
2019-06-27 10:06:07 +08:00
TopBar({@required this.children, @required this.title, this.search});
2019-02-08 11:50:49 +08:00
@override
Widget build(BuildContext context) {
final double statusbarHeight = MediaQuery.of(context).padding.top;
return Material(
type: MaterialType.canvas,
elevation: 5.0,
child: Container(
2019-06-14 08:41:49 +08:00
padding: EdgeInsets.only(top: statusbarHeight, bottom: 0),
child: Material(
type: MaterialType.transparency,
elevation: 0.0,
color: Colors.transparent,
2019-06-27 10:06:07 +08:00
child: Column(children: <Widget>[
Stack(alignment: Alignment.center, children: [
Text(title, style: Theme.of(context).accentTextTheme.display1),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: children,
)
]),
(search != null)
? Padding(
padding: EdgeInsets.only(
left: 10.0, right: 10.0, bottom: 10.0),
child: search)
: Container(),
]),
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).primaryColor,
Theme.of(context).primaryColorDark
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0, 1.0],
tileMode: TileMode.clamp),
),
));
2019-02-08 11:50:49 +08:00
}
}