blob: b450b1f1f5219fe6e4caed3c2e8a900a31680bf1 [file] [log] [blame]
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'message.dart' as generated;
Future<void> main() async {
enableFlutterDriverExtension();
runApp(ExampleWidget());
}
class ExampleWidget extends StatefulWidget {
@override
_ExampleWidgetState createState() => _ExampleWidgetState();
}
class _ExampleWidgetState extends State<ExampleWidget> {
bool _pressed = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: const Text('Press Button, Get Coffee'),
onPressed: () async {
setState(() {
_pressed = true;
});
},
),
if (_pressed) GeneratedWidget() else const SizedBox(),
],
),
),
);
}
}
class GeneratedWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Text(generated.message as String);
}
}