Commit 5dd8bd6e authored by Hixie's avatar Hixie

Allow non-Material apps to use the Title widget.

parent 5252a300
...@@ -53,7 +53,6 @@ export 'src/material/theme.dart'; ...@@ -53,7 +53,6 @@ export 'src/material/theme.dart';
export 'src/material/theme_data.dart'; export 'src/material/theme_data.dart';
export 'src/material/time_picker.dart'; export 'src/material/time_picker.dart';
export 'src/material/time_picker_dialog.dart'; export 'src/material/time_picker_dialog.dart';
export 'src/material/title.dart';
export 'src/material/toggleable.dart'; export 'src/material/toggleable.dart';
export 'src/material/tool_bar.dart'; export 'src/material/tool_bar.dart';
export 'src/material/typography.dart'; export 'src/material/typography.dart';
......
...@@ -10,7 +10,6 @@ import 'package:flutter/widgets.dart'; ...@@ -10,7 +10,6 @@ import 'package:flutter/widgets.dart';
import 'page.dart'; import 'page.dart';
import 'theme.dart'; import 'theme.dart';
import 'title.dart';
const TextStyle _errorTextStyle = const TextStyle( const TextStyle _errorTextStyle = const TextStyle(
color: const Color(0xD0FF0000), color: const Color(0xD0FF0000),
...@@ -107,16 +106,18 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver { ...@@ -107,16 +106,18 @@ class _MaterialAppState extends State<MaterialApp> implements BindingObserver {
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
ThemeData theme = config.theme ?? new ThemeData.fallback();
return new MediaQuery( return new MediaQuery(
data: new MediaQueryData(size: _size), data: new MediaQueryData(size: _size),
child: new Theme( child: new Theme(
data: config.theme ?? new ThemeData.fallback(), data: theme,
child: new DefaultTextStyle( child: new DefaultTextStyle(
style: _errorTextStyle, style: _errorTextStyle,
child: new DefaultAssetBundle( child: new DefaultAssetBundle(
bundle: _defaultBundle, bundle: _defaultBundle,
child: new Title( child: new Title(
title: config.title, title: config.title,
color: theme.primaryColor,
child: new Navigator( child: new Navigator(
key: _navigator, key: _navigator,
initialRoute: ui.window.defaultRouteName, initialRoute: ui.window.defaultRouteName,
......
...@@ -5,21 +5,21 @@ ...@@ -5,21 +5,21 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'theme.dart';
class Title extends StatelessComponent { class Title extends StatelessComponent {
Title({ this.title, this.child }); Title({ this.title, this.child, this.color });
final Widget child; final Widget child;
final String title; final String title;
final Color color;
Widget build(BuildContext context) { Widget build(BuildContext context) {
updateTaskDescription(title, Theme.of(context).primaryColor); updateTaskDescription(title, color);
return child; return child;
} }
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
description.add('"$title"'); description.add('"$title"');
description.add('color: $color');
} }
} }
...@@ -33,6 +33,7 @@ export 'src/widgets/routes.dart'; ...@@ -33,6 +33,7 @@ export 'src/widgets/routes.dart';
export 'src/widgets/scrollable.dart'; export 'src/widgets/scrollable.dart';
export 'src/widgets/statistics_overlay.dart'; export 'src/widgets/statistics_overlay.dart';
export 'src/widgets/status_transitions.dart'; export 'src/widgets/status_transitions.dart';
export 'src/widgets/title.dart';
export 'src/widgets/transitions.dart'; export 'src/widgets/transitions.dart';
export 'src/widgets/unique_component.dart'; export 'src/widgets/unique_component.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment