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/cupertino.dart'; |
6 | |
7 | /// Flutter code sample for [CupertinoButton]. |
8 | |
9 | void main() => runApp(const CupertinoButtonApp()); |
10 | |
11 | class CupertinoButtonApp extends StatelessWidget { |
12 | const CupertinoButtonApp({super.key}); |
13 | |
14 | @override |
15 | Widget build(BuildContext context) { |
16 | return const CupertinoApp( |
17 | theme: CupertinoThemeData(brightness: Brightness.light), |
18 | home: CupertinoButtonExample(), |
19 | ); |
20 | } |
21 | } |
22 | |
23 | class CupertinoButtonExample extends StatelessWidget { |
24 | const CupertinoButtonExample({super.key}); |
25 | |
26 | @override |
27 | Widget build(BuildContext context) { |
28 | return CupertinoPageScaffold( |
29 | navigationBar: const CupertinoNavigationBar(middle: Text('CupertinoButton Sample')), |
30 | child: Center( |
31 | child: Column( |
32 | mainAxisSize: MainAxisSize.min, |
33 | children: <Widget>[ |
34 | const CupertinoButton(onPressed: null, child: Text('Disabled')), |
35 | const SizedBox(height: 30), |
36 | const CupertinoButton.filled(onPressed: null, child: Text('Disabled')), |
37 | const SizedBox(height: 30), |
38 | CupertinoButton(onPressed: () {}, child: const Text('Enabled')), |
39 | const SizedBox(height: 30), |
40 | CupertinoButton.filled(onPressed: () {}, child: const Text('Enabled')), |
41 | ], |
42 | ), |
43 | ), |
44 | ); |
45 | } |
46 | } |
47 |