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( |
30 | middle: Text('CupertinoButton Sample'), |
31 | ), |
32 | child: Center( |
33 | child: Column( |
34 | mainAxisSize: MainAxisSize.min, |
35 | children: <Widget>[ |
36 | const CupertinoButton( |
37 | onPressed: null, |
38 | child: Text('Disabled'), |
39 | ), |
40 | const SizedBox(height: 30), |
41 | const CupertinoButton.filled( |
42 | onPressed: null, |
43 | child: Text('Disabled'), |
44 | ), |
45 | const SizedBox(height: 30), |
46 | CupertinoButton( |
47 | onPressed: () {}, |
48 | child: const Text('Enabled'), |
49 | ), |
50 | const SizedBox(height: 30), |
51 | CupertinoButton.filled( |
52 | onPressed: () {}, |
53 | child: const Text('Enabled'), |
54 | ), |
55 | ], |
56 | ), |
57 | ), |
58 | ); |
59 | } |
60 | } |
61 |