blob: bc78fb06fe3e76e2efbac1c7cae363c3807fc5d2 [file] [log] [blame]
// 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.
// Flutter code sample for CupertinoPageScaffold
import 'package:flutter/cupertino.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
Widget build(BuildContext context) {
return const CupertinoApp(
title: _title,
home: MyStatefulWidget(),
);
}
}
class MyStatefulWidget extends StatefulWidget {
const MyStatefulWidget({Key? key}) : super(key: key);
@override
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
}
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
int _count = 0;
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
// Uncomment to change the background color
// backgroundColor: CupertinoColors.systemPink,
navigationBar: const CupertinoNavigationBar(
middle: Text('Sample Code'),
),
child: ListView(
children: <Widget>[
CupertinoButton(
onPressed: () => setState(() => _count++),
child: const Icon(CupertinoIcons.add),
),
Center(
child: Text('You have pressed the button $_count times.'),
),
],
),
);
}
}