// Copyright 2017 The Chromium 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/widgets.dart'; import 'package:flutter_driver/driver_extension.dart'; void main() { enableFlutterDriverExtension(); runApp(DriverTestApp()); } class DriverTestApp extends StatefulWidget { @override State createState() { return DriverTestAppState(); } } class DriverTestAppState extends State { bool present = true; Letter _selectedValue = Letter.a; @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('FlutterDriver test'), ), body: ListView( padding: const EdgeInsets.all(5.0), children: [ Row( children: [ Expanded( child: Text(present ? 'present' : 'absent'), ), RaisedButton( child: const Text( 'toggle', key: ValueKey('togglePresent'), ), onPressed: () { setState(() { present = !present; }); }, ), ], ), Row( children: [ const Expanded( child: Text('hit testability'), ), DropdownButton( key: const ValueKey('dropdown'), value: _selectedValue, onChanged: (Letter newValue) { setState(() { _selectedValue = newValue; }); }, items: const >[ DropdownMenuItem( value: Letter.a, child: Text('Aaa', key: ValueKey('a')), ), DropdownMenuItem( value: Letter.b, child: Text('Bbb', key: ValueKey('b')), ), DropdownMenuItem( value: Letter.c, child: Text('Ccc', key: ValueKey('c')), ), ], ), ], ), const TextField( key: ValueKey('enter-text-field'), ), ], ), ), ); } } enum Letter { a, b, c }