1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
---|---|
2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. |
4 | |
5 | import 'package:flutter/material.dart'; |
6 | |
7 | /// Flutter code sample for [Stepper.controlsBuilder]. |
8 | |
9 | void main() => runApp(const ControlsBuilderExampleApp()); |
10 | |
11 | class ControlsBuilderExampleApp extends StatelessWidget { |
12 | const ControlsBuilderExampleApp({super.key}); |
13 | |
14 | @override |
15 | Widget build(BuildContext context) { |
16 | return MaterialApp( |
17 | home: Scaffold( |
18 | appBar: AppBar(title: const Text('Stepper Sample')), |
19 | body: const ControlsBuilderExample(), |
20 | ), |
21 | ); |
22 | } |
23 | } |
24 | |
25 | class ControlsBuilderExample extends StatelessWidget { |
26 | const ControlsBuilderExample({super.key}); |
27 | |
28 | @override |
29 | Widget build(BuildContext context) { |
30 | return Stepper( |
31 | controlsBuilder: (BuildContext context, ControlsDetails details) { |
32 | return Row( |
33 | children: <Widget>[ |
34 | TextButton(onPressed: details.onStepContinue, child: const Text('NEXT')), |
35 | TextButton(onPressed: details.onStepCancel, child: const Text('CANCEL')), |
36 | ], |
37 | ); |
38 | }, |
39 | steps: const <Step>[ |
40 | Step(title: Text('A'), content: SizedBox(width: 100.0, height: 100.0)), |
41 | Step(title: Text('B'), content: SizedBox(width: 100.0, height: 100.0)), |
42 | ], |
43 | ); |
44 | } |
45 | } |
46 |