Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
3ed0bbed
Unverified
Commit
3ed0bbed
authored
May 05, 2022
by
Taha Tesser
Committed by
GitHub
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`CupertinoActivityIndicator`: Add an interactive example (#103040)
parent
86e55df7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
0 deletions
+109
-0
cupertino_activity_indicator.0.dart
...no/activity_indicator/cupertino_activity_indicator.0.dart
+72
-0
cupertino_activity_indicator.0_test.dart
...tivity_indicator/cupertino_activity_indicator.0_test.dart
+31
-0
activity_indicator.dart
packages/flutter/lib/src/cupertino/activity_indicator.dart
+6
-0
No files found.
examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart
0 → 100644
View file @
3ed0bbed
// 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 CupertinoActivityIndicator
import
'package:flutter/cupertino.dart'
;
void
main
(
)
=>
runApp
(
const
CupertinoIndicatorApp
());
class
CupertinoIndicatorApp
extends
StatelessWidget
{
const
CupertinoIndicatorApp
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
home:
CupertinoIndicatorExample
(),
);
}
}
class
CupertinoIndicatorExample
extends
StatelessWidget
{
const
CupertinoIndicatorExample
({
Key
?
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
CupertinoPageScaffold
(
child:
Center
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
<
Widget
>[
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
<
Widget
>[
// Cupertino activity indicator with default properties.
CupertinoActivityIndicator
(),
SizedBox
(
height:
10
),
Text
(
'Default'
),
],
),
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
<
Widget
>[
// Cupertino activity indicator with custom radius and color.
CupertinoActivityIndicator
(
radius:
20.0
,
color:
CupertinoColors
.
activeBlue
),
SizedBox
(
height:
10
),
Text
(
'radius: 20.0
\n
color: CupertinoColors.activeBlue'
,
textAlign:
TextAlign
.
center
,
),
],
),
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
<
Widget
>[
// Cupertino activity indicator with custom radius and disabled animation.
CupertinoActivityIndicator
(
radius:
20.0
,
animating:
false
),
SizedBox
(
height:
10
),
Text
(
'radius: 20.0
\n
animating: false'
,
textAlign:
TextAlign
.
center
,
),
],
),
],
),
)
);
}
}
examples/api/test/cupertino/activity_indicator/cupertino_activity_indicator.0_test.dart
0 → 100644
View file @
3ed0bbed
// 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'
;
import
'package:flutter_api_samples/cupertino/activity_indicator/cupertino_activity_indicator.0.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'Default and customized cupertino activity indicators'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
CupertinoIndicatorApp
(),
);
// Cupertino activity indicator with default properties.
final
Finder
firstIndicator
=
find
.
byType
(
CupertinoActivityIndicator
).
at
(
0
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
firstIndicator
).
animating
,
true
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
firstIndicator
).
radius
,
10.0
);
// Cupertino activity indicator with custom radius and color.
final
Finder
secondIndicator
=
find
.
byType
(
CupertinoActivityIndicator
).
at
(
1
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
secondIndicator
).
animating
,
true
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
secondIndicator
).
radius
,
20.0
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
secondIndicator
).
color
,
CupertinoColors
.
activeBlue
);
// Cupertino activity indicator with custom radius and disabled animation.
final
Finder
thirdIndicator
=
find
.
byType
(
CupertinoActivityIndicator
).
at
(
2
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
thirdIndicator
).
animating
,
false
);
expect
(
tester
.
widget
<
CupertinoActivityIndicator
>(
thirdIndicator
).
radius
,
20.0
);
});
}
packages/flutter/lib/src/cupertino/activity_indicator.dart
View file @
3ed0bbed
...
...
@@ -20,6 +20,12 @@ const Color _kActiveTickColor = CupertinoDynamicColor.withBrightness(
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=AENVH-ZqKDQ}
///
/// {@tool dartpad}
/// This example shows how [CupertinoActivityIndicator] can be customized.
///
/// ** See code in examples/api/lib/cupertino/activity_indicator/cupertino_activity_indicator.0.dart **
/// {@end-tool}
///
/// See also:
///
/// * <https://developer.apple.com/ios/human-interface-guidelines/controls/progress-indicators/#activity-indicators>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment