| // 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/cupertino.dart'; |
| |
| /// Flutter code sample for [CupertinoPageScaffold]. |
| |
| void main() => runApp(const PageScaffoldApp()); |
| |
| class PageScaffoldApp extends StatelessWidget { |
| const PageScaffoldApp({super.key}); |
| |
| @override |
| Widget build(BuildContext context) { |
| return const CupertinoApp( |
| theme: CupertinoThemeData(brightness: Brightness.light), |
| home: PageScaffoldExample(), |
| ); |
| } |
| } |
| |
| class PageScaffoldExample extends StatefulWidget { |
| const PageScaffoldExample({super.key}); |
| |
| @override |
| State<PageScaffoldExample> createState() => _PageScaffoldExampleState(); |
| } |
| |
| class _PageScaffoldExampleState extends State<PageScaffoldExample> { |
| int _count = 0; |
| |
| @override |
| Widget build(BuildContext context) { |
| return CupertinoPageScaffold( |
| // Uncomment to change the background color |
| // backgroundColor: CupertinoColors.systemPink, |
| navigationBar: const CupertinoNavigationBar( |
| middle: Text('CupertinoPageScaffold Sample'), |
| ), |
| child: Center( |
| child: Column( |
| mainAxisAlignment: MainAxisAlignment.center, |
| children: <Widget>[ |
| Center( |
| child: Text('You have pressed the button $_count times.'), |
| ), |
| const SizedBox(height: 20.0), |
| Center( |
| child: CupertinoButton.filled( |
| onPressed: () => setState(() => _count++), |
| child: const Icon(CupertinoIcons.add), |
| ), |
| ), |
| ], |
| ), |
| ), |
| ); |
| } |
| } |