Commit 37821891 authored by Hans Muller's avatar Hans Muller

Merge pull request #1259 from HansMuller/progress_indicator

Update progress_indicator widget example

Update the progress_indicator demo: it was using Title explicitly, which is no longer needed.

Defend against a null color in updateTaskDescription. The color field in the TaskDescription struct (activity.mojom) isn't nullable.

Fixes #1248
parents abb17ea9 179ca816
...@@ -6,10 +6,10 @@ import 'package:flutter/animation.dart'; ...@@ -6,10 +6,10 @@ import 'package:flutter/animation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ProgressIndicatorApp extends StatefulComponent { class ProgressIndicatorApp extends StatefulComponent {
ProgressIndicatorAppState createState() => new ProgressIndicatorAppState(); _ProgressIndicatorAppState createState() => new _ProgressIndicatorAppState();
} }
class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { class _ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
void initState() { void initState() {
super.initState(); super.initState();
valueAnimation = new ValuePerformance<double>() valueAnimation = new ValuePerformance<double>()
...@@ -98,14 +98,11 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -98,14 +98,11 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
accentColor: Colors.redAccent[200] accentColor: Colors.redAccent[200]
), ),
child: new Title( child: new Scaffold(
title: 'Progress Indicators', toolBar: new ToolBar(center: new Text('Progress Indicators')),
child: new Scaffold( body: new DefaultTextStyle(
toolBar: new ToolBar(center: new Text('Progress Indicators')), style: Theme.of(context).text.title,
body: new DefaultTextStyle( child: body
style: Theme.of(context).text.title,
child: body
)
) )
) )
) )
...@@ -114,5 +111,10 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> { ...@@ -114,5 +111,10 @@ class ProgressIndicatorAppState extends State<ProgressIndicatorApp> {
} }
void main() { void main() {
runApp(new ProgressIndicatorApp()); runApp(new MaterialApp(
title: 'Progress Indicators',
routes: {
'/': (RouteArguments args) => new ProgressIndicatorApp()
}
));
} }
...@@ -60,7 +60,7 @@ void updateTaskDescription(String label, Color color) { ...@@ -60,7 +60,7 @@ void updateTaskDescription(String label, Color color) {
TaskDescription description = new TaskDescription() TaskDescription description = new TaskDescription()
..label = label ..label = label
..primaryColor = color?.value; ..primaryColor = color?.value ?? 0;
_activityProxy.ptr.setTaskDescription(description); _activityProxy.ptr.setTaskDescription(description);
} }
......
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