Skip to content

Commit 5de4120

Browse files
committed
Merge remote-tracking branch 'source-origin/master' into decoupling-material-and-cupertino
Merging in everything I can think of for material_ui and cupertino_ui, so the histories are aligned and all commits are the same.
2 parents 6351fa4 + 9b65985 commit 5de4120

554 files changed

Lines changed: 289026 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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 [CupertinoActivityIndicator].
8+
9+
void main() => runApp(const CupertinoIndicatorApp());
10+
11+
class CupertinoIndicatorApp extends StatelessWidget {
12+
const CupertinoIndicatorApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return const CupertinoApp(
17+
theme: CupertinoThemeData(brightness: .light),
18+
home: CupertinoIndicatorExample(),
19+
);
20+
}
21+
}
22+
23+
class CupertinoIndicatorExample extends StatelessWidget {
24+
const CupertinoIndicatorExample({super.key});
25+
26+
@override
27+
Widget build(BuildContext context) {
28+
return const CupertinoPageScaffold(
29+
navigationBar: CupertinoNavigationBar(
30+
middle: Text('CupertinoActivityIndicator Sample'),
31+
),
32+
child: Center(
33+
child: Column(
34+
mainAxisAlignment: .spaceEvenly,
35+
children: <Widget>[
36+
Column(
37+
mainAxisAlignment: .center,
38+
children: <Widget>[
39+
// Cupertino activity indicator with default properties.
40+
CupertinoActivityIndicator(),
41+
SizedBox(height: 10),
42+
Text('Default'),
43+
],
44+
),
45+
Column(
46+
mainAxisAlignment: .center,
47+
children: <Widget>[
48+
// Cupertino activity indicator with custom radius and color.
49+
CupertinoActivityIndicator(
50+
radius: 20.0,
51+
color: CupertinoColors.activeBlue,
52+
),
53+
SizedBox(height: 10),
54+
Text(
55+
'radius: 20.0\ncolor: CupertinoColors.activeBlue',
56+
textAlign: .center,
57+
),
58+
],
59+
),
60+
Column(
61+
mainAxisAlignment: .center,
62+
children: <Widget>[
63+
// Cupertino activity indicator with custom radius and disabled
64+
// animation.
65+
CupertinoActivityIndicator(radius: 20.0, animating: false),
66+
SizedBox(height: 10),
67+
Text('radius: 20.0\nanimating: false', textAlign: .center),
68+
],
69+
),
70+
],
71+
),
72+
),
73+
);
74+
}
75+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 [CupertinoLinearActivityIndicator].
8+
9+
void main() => runApp(const CupertinoLinearActivityIndicatorApp());
10+
11+
class CupertinoLinearActivityIndicatorApp extends StatelessWidget {
12+
const CupertinoLinearActivityIndicatorApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return const CupertinoApp(
17+
theme: CupertinoThemeData(brightness: .light),
18+
home: CupertinoIndicatorExample(),
19+
);
20+
}
21+
}
22+
23+
class CupertinoIndicatorExample extends StatelessWidget {
24+
const CupertinoIndicatorExample({super.key});
25+
26+
@override
27+
Widget build(BuildContext context) {
28+
return const CupertinoPageScaffold(
29+
navigationBar: CupertinoNavigationBar(
30+
middle: Text('CupertinoLinearActivityIndicator Sample'),
31+
),
32+
child: Padding(
33+
padding: .all(8.0),
34+
child: Column(
35+
mainAxisAlignment: .spaceEvenly,
36+
children: <Widget>[
37+
Column(
38+
mainAxisAlignment: .center,
39+
children: <Widget>[
40+
CupertinoLinearActivityIndicator(progress: 0),
41+
SizedBox(height: 10),
42+
Text('Progress: 0'),
43+
],
44+
),
45+
Column(
46+
mainAxisAlignment: .center,
47+
children: <Widget>[
48+
CupertinoLinearActivityIndicator(progress: 0.2),
49+
SizedBox(height: 10),
50+
Text('Progress: 0.2', textAlign: .center),
51+
],
52+
),
53+
Column(
54+
mainAxisAlignment: .center,
55+
children: <Widget>[
56+
CupertinoLinearActivityIndicator(progress: 0.4, height: 10),
57+
SizedBox(height: 10),
58+
Text('Height: 10', textAlign: .center),
59+
],
60+
),
61+
Column(
62+
mainAxisAlignment: .center,
63+
children: <Widget>[
64+
CupertinoLinearActivityIndicator(
65+
progress: 0.6,
66+
color: CupertinoColors.activeGreen,
67+
),
68+
SizedBox(height: 10),
69+
Text('Color: green', textAlign: .center),
70+
],
71+
),
72+
],
73+
),
74+
),
75+
);
76+
}
77+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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 [CupertinoTabBar].
8+
9+
void main() => runApp(const CupertinoTabBarApp());
10+
11+
class CupertinoTabBarApp extends StatelessWidget {
12+
const CupertinoTabBarApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return const CupertinoApp(
17+
theme: CupertinoThemeData(brightness: .light),
18+
home: CupertinoTabBarExample(),
19+
);
20+
}
21+
}
22+
23+
class CupertinoTabBarExample extends StatelessWidget {
24+
const CupertinoTabBarExample({super.key});
25+
26+
@override
27+
Widget build(BuildContext context) {
28+
return CupertinoTabScaffold(
29+
tabBar: CupertinoTabBar(
30+
items: const <BottomNavigationBarItem>[
31+
BottomNavigationBarItem(
32+
icon: Icon(CupertinoIcons.star_fill),
33+
label: 'Favorites',
34+
),
35+
BottomNavigationBarItem(
36+
icon: Icon(CupertinoIcons.clock_solid),
37+
label: 'Recents',
38+
),
39+
BottomNavigationBarItem(
40+
icon: Icon(CupertinoIcons.person_alt_circle_fill),
41+
label: 'Contacts',
42+
),
43+
BottomNavigationBarItem(
44+
icon: Icon(CupertinoIcons.circle_grid_3x3_fill),
45+
label: 'Keypad',
46+
),
47+
],
48+
),
49+
tabBuilder: (BuildContext context, int index) {
50+
return CupertinoTabView(
51+
builder: (BuildContext context) {
52+
return Center(child: Text('Content of tab $index'));
53+
},
54+
);
55+
},
56+
);
57+
}
58+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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: .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: .min,
35+
children: <Widget>[
36+
const CupertinoButton(onPressed: null, child: Text('Disabled')),
37+
const SizedBox(height: 30),
38+
const CupertinoButton.filled(
39+
onPressed: null,
40+
child: Text('Disabled'),
41+
),
42+
const SizedBox(height: 30),
43+
CupertinoButton(onPressed: () {}, child: const Text('Enabled')),
44+
const SizedBox(height: 30),
45+
CupertinoButton.filled(
46+
onPressed: () {},
47+
child: const Text('Enabled'),
48+
),
49+
],
50+
),
51+
),
52+
);
53+
}
54+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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 [CupertinoCheckbox].
8+
9+
void main() => runApp(const CupertinoCheckboxApp());
10+
11+
class CupertinoCheckboxApp extends StatelessWidget {
12+
const CupertinoCheckboxApp({super.key});
13+
14+
@override
15+
Widget build(BuildContext context) {
16+
return const CupertinoApp(
17+
theme: CupertinoThemeData(brightness: .light),
18+
home: CupertinoPageScaffold(
19+
navigationBar: CupertinoNavigationBar(
20+
middle: Text('CupertinoCheckbox Example'),
21+
),
22+
child: SafeArea(child: CupertinoCheckboxExample()),
23+
),
24+
);
25+
}
26+
}
27+
28+
class CupertinoCheckboxExample extends StatefulWidget {
29+
const CupertinoCheckboxExample({super.key});
30+
31+
@override
32+
State<CupertinoCheckboxExample> createState() =>
33+
_CupertinoCheckboxExampleState();
34+
}
35+
36+
class _CupertinoCheckboxExampleState extends State<CupertinoCheckboxExample> {
37+
bool? isChecked = true;
38+
39+
@override
40+
Widget build(BuildContext context) {
41+
return CupertinoCheckbox(
42+
checkColor: CupertinoColors.white,
43+
// Set tristate to true to make the checkbox display a null value
44+
// in addition to the default true and false values.
45+
tristate: true,
46+
value: isChecked,
47+
onChanged: (bool? value) {
48+
setState(() {
49+
isChecked = value;
50+
});
51+
},
52+
);
53+
}
54+
}

0 commit comments

Comments
 (0)