text
stringlengths 6
13.6M
| id
stringlengths 13
176
| metadata
dict | __index_level_0__
int64 0
1.69k
|
---|---|---|---|
// 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/material.dart';
import '../../gallery_localizations.dart';
// BEGIN bannerDemo
enum BannerDemoAction {
reset,
showMultipleActions,
showLeading,
}
class BannerDemo extends StatefulWidget {
const BannerDemo({super.key});
@override
State<BannerDemo> createState() => _BannerDemoState();
}
class _BannerDemoState extends State<BannerDemo> with RestorationMixin {
static const int _itemCount = 20;
@override
String get restorationId => 'banner_demo';
@override
void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
registerForRestoration(_displayBanner, 'display_banner');
registerForRestoration(_showMultipleActions, 'show_multiple_actions');
registerForRestoration(_showLeading, 'show_leading');
}
final RestorableBool _displayBanner = RestorableBool(true);
final RestorableBool _showMultipleActions = RestorableBool(true);
final RestorableBool _showLeading = RestorableBool(true);
@override
void dispose() {
_displayBanner.dispose();
_showMultipleActions.dispose();
_showLeading.dispose();
super.dispose();
}
void handleDemoAction(BannerDemoAction action) {
setState(() {
switch (action) {
case BannerDemoAction.reset:
_displayBanner.value = true;
_showMultipleActions.value = true;
_showLeading.value = true;
case BannerDemoAction.showMultipleActions:
_showMultipleActions.value = !_showMultipleActions.value;
case BannerDemoAction.showLeading:
_showLeading.value = !_showLeading.value;
}
});
}
@override
Widget build(BuildContext context) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
final GalleryLocalizations localizations = GalleryLocalizations.of(context)!;
final MaterialBanner banner = MaterialBanner(
content: Text(localizations.bannerDemoText),
leading: _showLeading.value
? CircleAvatar(
backgroundColor: colorScheme.primary,
child: Icon(Icons.access_alarm, color: colorScheme.onPrimary),
)
: null,
actions: <Widget>[
TextButton(
onPressed: () {
setState(() {
_displayBanner.value = false;
});
},
child: Text(localizations.signIn),
),
if (_showMultipleActions.value)
TextButton(
onPressed: () {
setState(() {
_displayBanner.value = false;
});
},
child: Text(localizations.dismiss),
),
],
backgroundColor: colorScheme.background,
);
return Scaffold(
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text(localizations.demoBannerTitle),
actions: <Widget>[
PopupMenuButton<BannerDemoAction>(
onSelected: handleDemoAction,
itemBuilder: (BuildContext context) => <PopupMenuEntry<BannerDemoAction>>[
PopupMenuItem<BannerDemoAction>(
value: BannerDemoAction.reset,
child: Text(localizations.bannerDemoResetText),
),
const PopupMenuDivider(),
CheckedPopupMenuItem<BannerDemoAction>(
value: BannerDemoAction.showMultipleActions,
checked: _showMultipleActions.value,
child: Text(localizations.bannerDemoMultipleText),
),
CheckedPopupMenuItem<BannerDemoAction>(
value: BannerDemoAction.showLeading,
checked: _showLeading.value,
child: Text(localizations.bannerDemoLeadingText),
),
],
),
],
),
body: ListView.builder(
restorationId: 'banner_demo_list_view',
itemCount: _displayBanner.value ? _itemCount + 1 : _itemCount,
itemBuilder: (BuildContext context, int index) {
if (index == 0 && _displayBanner.value) {
return banner;
}
return ListTile(
title: Text(
localizations.starterAppDrawerItem(
_displayBanner.value ? index : index + 1),
),
);
},
),
);
}
}
// END
| flutter/dev/integration_tests/new_gallery/lib/demos/material/banner_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/demos/material/banner_demo.dart",
"repo_id": "flutter",
"token_count": 1965
} | 700 |
// 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/material.dart';
import '../../gallery_localizations.dart';
// BEGIN navRailDemo
class NavRailDemo extends StatefulWidget {
const NavRailDemo({super.key});
@override
State<NavRailDemo> createState() => _NavRailDemoState();
}
class _NavRailDemoState extends State<NavRailDemo> with RestorationMixin {
final RestorableInt _selectedIndex = RestorableInt(0);
@override
String get restorationId => 'nav_rail_demo';
@override
void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
registerForRestoration(_selectedIndex, 'selected_index');
}
@override
void dispose() {
_selectedIndex.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final GalleryLocalizations localization = GalleryLocalizations.of(context)!;
final String destinationFirst = localization.demoNavigationRailFirst;
final String destinationSecond = localization.demoNavigationRailSecond;
final String destinationThird = localization.demoNavigationRailThird;
final List<String> selectedItem = <String>[
destinationFirst,
destinationSecond,
destinationThird
];
return Scaffold(
appBar: AppBar(
title: Text(
localization.demoNavigationRailTitle,
),
),
body: Row(
children: <Widget>[
NavigationRail(
leading: FloatingActionButton(
onPressed: () {},
tooltip: localization.buttonTextCreate,
child: const Icon(Icons.add),
),
selectedIndex: _selectedIndex.value,
onDestinationSelected: (int index) {
setState(() {
_selectedIndex.value = index;
});
},
labelType: NavigationRailLabelType.selected,
destinations: <NavigationRailDestination>[
NavigationRailDestination(
icon: const Icon(
Icons.favorite_border,
),
selectedIcon: const Icon(
Icons.favorite,
),
label: Text(
destinationFirst,
),
),
NavigationRailDestination(
icon: const Icon(
Icons.bookmark_border,
),
selectedIcon: const Icon(
Icons.book,
),
label: Text(
destinationSecond,
),
),
NavigationRailDestination(
icon: const Icon(
Icons.star_border,
),
selectedIcon: const Icon(
Icons.star,
),
label: Text(
destinationThird,
),
),
],
),
const VerticalDivider(thickness: 1, width: 1),
Expanded(
child: Center(
child: Text(
selectedItem[_selectedIndex.value],
),
),
),
],
),
);
}
}
// END
| flutter/dev/integration_tests/new_gallery/lib/demos/material/navigation_rail_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/demos/material/navigation_rail_demo.dart",
"repo_id": "flutter",
"token_count": 1602
} | 701 |
// 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 'dart:ui';
import 'package:flutter/material.dart';
import '../../gallery_localizations.dart';
import 'transformations_demo_board.dart';
import 'transformations_demo_edit_board_point.dart';
// BEGIN transformationsDemo#1
class TransformationsDemo extends StatefulWidget {
const TransformationsDemo({super.key});
@override
State<TransformationsDemo> createState() => _TransformationsDemoState();
}
class _TransformationsDemoState extends State<TransformationsDemo>
with TickerProviderStateMixin {
final GlobalKey _targetKey = GlobalKey();
// The radius of a hexagon tile in pixels.
static const double _kHexagonRadius = 16.0;
// The margin between hexagons.
static const double _kHexagonMargin = 1.0;
// The radius of the entire board in hexagons, not including the center.
static const int _kBoardRadius = 8;
Board _board = Board(
boardRadius: _kBoardRadius,
hexagonRadius: _kHexagonRadius,
hexagonMargin: _kHexagonMargin,
);
final TransformationController _transformationController =
TransformationController();
Animation<Matrix4>? _animationReset;
late AnimationController _controllerReset;
Matrix4? _homeMatrix;
// Handle reset to home transform animation.
void _onAnimateReset() {
_transformationController.value = _animationReset!.value;
if (!_controllerReset.isAnimating) {
_animationReset?.removeListener(_onAnimateReset);
_animationReset = null;
_controllerReset.reset();
}
}
// Initialize the reset to home transform animation.
void _animateResetInitialize() {
_controllerReset.reset();
_animationReset = Matrix4Tween(
begin: _transformationController.value,
end: _homeMatrix,
).animate(_controllerReset);
_controllerReset.duration = const Duration(milliseconds: 400);
_animationReset!.addListener(_onAnimateReset);
_controllerReset.forward();
}
// Stop a running reset to home transform animation.
void _animateResetStop() {
_controllerReset.stop();
_animationReset?.removeListener(_onAnimateReset);
_animationReset = null;
_controllerReset.reset();
}
void _onScaleStart(ScaleStartDetails details) {
// If the user tries to cause a transformation while the reset animation is
// running, cancel the reset animation.
if (_controllerReset.status == AnimationStatus.forward) {
_animateResetStop();
}
}
void _onTapUp(TapUpDetails details) {
final RenderBox renderBox =
_targetKey.currentContext!.findRenderObject()! as RenderBox;
final Offset offset =
details.globalPosition - renderBox.localToGlobal(Offset.zero);
final Offset scenePoint = _transformationController.toScene(offset);
final BoardPoint? boardPoint = _board.pointToBoardPoint(scenePoint);
setState(() {
_board = _board.copyWithSelected(boardPoint);
});
}
@override
void initState() {
super.initState();
_controllerReset = AnimationController(
vsync: this,
);
}
@override
Widget build(BuildContext context) {
// The scene is drawn by a CustomPaint, but user interaction is handled by
// the InteractiveViewer parent widget.
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.primary,
appBar: AppBar(
automaticallyImplyLeading: false,
title:
Text(GalleryLocalizations.of(context)!.demo2dTransformationsTitle),
),
body: ColoredBox(
color: backgroundColor,
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
// Draw the scene as big as is available, but allow the user to
// translate beyond that to a visibleSize that's a bit bigger.
final Size viewportSize = Size(
constraints.maxWidth,
constraints.maxHeight,
);
// Start the first render, start the scene centered in the viewport.
if (_homeMatrix == null) {
_homeMatrix = Matrix4.identity()
..translate(
viewportSize.width / 2 - _board.size.width / 2,
viewportSize.height / 2 - _board.size.height / 2,
);
_transformationController.value = _homeMatrix!;
}
return ClipRect(
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTapUp: _onTapUp,
child: InteractiveViewer(
key: _targetKey,
transformationController: _transformationController,
boundaryMargin: EdgeInsets.symmetric(
horizontal: viewportSize.width,
vertical: viewportSize.height,
),
minScale: 0.01,
onInteractionStart: _onScaleStart,
child: SizedBox.expand(
child: CustomPaint(
size: _board.size,
painter: _BoardPainter(
board: _board,
),
),
),
),
),
),
);
},
),
),
persistentFooterButtons: <Widget>[resetButton, editButton],
);
}
IconButton get resetButton {
return IconButton(
onPressed: () {
setState(() {
_animateResetInitialize();
});
},
tooltip: 'Reset',
color: Theme.of(context).colorScheme.surface,
icon: const Icon(Icons.replay),
);
}
IconButton get editButton {
return IconButton(
onPressed: () {
if (_board.selected == null) {
return;
}
showModalBottomSheet<Widget>(
context: context,
builder: (BuildContext context) {
return Container(
width: double.infinity,
height: 150,
padding: const EdgeInsets.all(12),
child: EditBoardPoint(
boardPoint: _board.selected!,
onColorSelection: (Color color) {
setState(() {
_board = _board.copyWithBoardPointColor(
_board.selected!, color);
Navigator.pop(context);
});
},
),
);
});
},
tooltip: 'Edit',
color: Theme.of(context).colorScheme.surface,
icon: const Icon(Icons.edit),
);
}
@override
void dispose() {
_controllerReset.dispose();
super.dispose();
}
}
// CustomPainter is what is passed to CustomPaint and actually draws the scene
// when its `paint` method is called.
class _BoardPainter extends CustomPainter {
const _BoardPainter({required this.board});
final Board board;
@override
void paint(Canvas canvas, Size size) {
void drawBoardPoint(BoardPoint? boardPoint) {
final Color color = boardPoint!.color.withOpacity(
board.selected == boardPoint ? 0.7 : 1,
);
final Vertices vertices = board.getVerticesForBoardPoint(boardPoint, color);
canvas.drawVertices(vertices, BlendMode.color, Paint());
}
board.forEach(drawBoardPoint);
}
// We should repaint whenever the board changes, such as board.selected.
@override
bool shouldRepaint(_BoardPainter oldDelegate) {
return oldDelegate.board != board;
}
}
// END
| flutter/dev/integration_tests/new_gallery/lib/demos/reference/transformations_demo.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/demos/reference/transformations_demo.dart",
"repo_id": "flutter",
"token_count": 3309
} | 702 |
// 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/material.dart';
abstract class BackLayerItem extends StatefulWidget {
const BackLayerItem({super.key, required this.index});
final int index;
}
class BackLayer extends StatefulWidget {
const BackLayer({
super.key,
required this.backLayerItems,
required this.tabController,
});
final List<BackLayerItem> backLayerItems;
final TabController tabController;
@override
State<BackLayer> createState() => _BackLayerState();
}
class _BackLayerState extends State<BackLayer> {
@override
void initState() {
super.initState();
widget.tabController.addListener(() => setState(() {}));
}
@override
Widget build(BuildContext context) {
final int tabIndex = widget.tabController.index;
return IndexedStack(
index: tabIndex,
children: <Widget>[
for (final BackLayerItem backLayerItem in widget.backLayerItems)
ExcludeFocus(
excluding: backLayerItem.index != tabIndex,
child: backLayerItem,
)
],
);
}
}
| flutter/dev/integration_tests/new_gallery/lib/studies/crane/backlayer.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/studies/crane/backlayer.dart",
"repo_id": "flutter",
"token_count": 412
} | 703 |
// 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:animations/animations.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:google_fonts/google_fonts.dart';
import '../../data/gallery_options.dart';
import '../../gallery_localizations.dart';
import '../../layout/letter_spacing.dart';
import 'colors.dart';
import 'home.dart';
import 'login.dart';
import 'routes.dart' as routes;
/// The RallyApp is a MaterialApp with a theme and 2 routes.
///
/// The home route is the main page with tabs for sub pages.
/// The login route is the initial route.
class RallyApp extends StatelessWidget {
const RallyApp({super.key});
static const String loginRoute = routes.loginRoute;
static const String homeRoute = routes.homeRoute;
static const SharedAxisPageTransitionsBuilder sharedZAxisTransitionBuilder = SharedAxisPageTransitionsBuilder(
fillColor: RallyColors.primaryBackground,
transitionType: SharedAxisTransitionType.scaled,
);
@override
Widget build(BuildContext context) {
return MaterialApp(
restorationScopeId: 'rally_app',
title: 'Rally',
debugShowCheckedModeBanner: false,
theme: _buildRallyTheme().copyWith(
platform: GalleryOptions.of(context).platform,
pageTransitionsTheme: PageTransitionsTheme(
builders: <TargetPlatform, PageTransitionsBuilder>{
for (final TargetPlatform type in TargetPlatform.values)
type: sharedZAxisTransitionBuilder,
},
),
),
localizationsDelegates: GalleryLocalizations.localizationsDelegates,
supportedLocales: GalleryLocalizations.supportedLocales,
locale: GalleryOptions.of(context).locale,
initialRoute: loginRoute,
routes: <String, WidgetBuilder>{
homeRoute: (BuildContext context) => const HomePage(),
loginRoute: (BuildContext context) => const LoginPage(),
},
);
}
ThemeData _buildRallyTheme() {
final ThemeData base = ThemeData.dark();
return ThemeData(
appBarTheme: const AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle.light,
backgroundColor: RallyColors.primaryBackground,
elevation: 0,
),
scaffoldBackgroundColor: RallyColors.primaryBackground,
focusColor: RallyColors.focusColor,
textTheme: _buildRallyTextTheme(base.textTheme),
inputDecorationTheme: const InputDecorationTheme(
labelStyle: TextStyle(
color: RallyColors.gray,
fontWeight: FontWeight.w500,
),
filled: true,
fillColor: RallyColors.inputBackground,
focusedBorder: InputBorder.none,
),
visualDensity: VisualDensity.standard,
colorScheme: base.colorScheme.copyWith(
primary: RallyColors.primaryBackground,
),
);
}
TextTheme _buildRallyTextTheme(TextTheme base) {
return base
.copyWith(
bodyMedium: GoogleFonts.robotoCondensed(
fontSize: 14,
fontWeight: FontWeight.w400,
letterSpacing: letterSpacingOrNone(0.5),
),
bodyLarge: GoogleFonts.eczar(
fontSize: 40,
fontWeight: FontWeight.w400,
letterSpacing: letterSpacingOrNone(1.4),
),
labelLarge: GoogleFonts.robotoCondensed(
fontWeight: FontWeight.w700,
letterSpacing: letterSpacingOrNone(2.8),
),
headlineSmall: GoogleFonts.eczar(
fontSize: 40,
fontWeight: FontWeight.w600,
letterSpacing: letterSpacingOrNone(1.4),
),
)
.apply(
displayColor: Colors.white,
bodyColor: Colors.white,
);
}
}
| flutter/dev/integration_tests/new_gallery/lib/studies/rally/app.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/studies/rally/app.dart",
"repo_id": "flutter",
"token_count": 1519
} | 704 |
// 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/material.dart';
import '../../../layout/adaptive.dart';
import '../colors.dart';
class TabWithSidebar extends StatelessWidget {
const TabWithSidebar({
super.key,
this.restorationId,
required this.mainView,
required this.sidebarItems,
});
final Widget mainView;
final List<Widget> sidebarItems;
final String? restorationId;
@override
Widget build(BuildContext context) {
if (isDisplayDesktop(context)) {
return Row(
children: <Widget>[
Flexible(
flex: 2,
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 24),
child: mainView,
),
),
),
Expanded(
child: Container(
color: RallyColors.inputBackground,
padding: const EdgeInsetsDirectional.only(start: 24),
height: double.infinity,
alignment: AlignmentDirectional.centerStart,
child: ListView(
shrinkWrap: true,
children: sidebarItems,
),
),
),
],
);
} else {
return SingleChildScrollView(
restorationId: restorationId,
child: mainView,
);
}
}
}
class SidebarItem extends StatelessWidget {
const SidebarItem({
super.key,
required this.value,
required this.title,
});
final String value;
final String title;
@override
Widget build(BuildContext context) {
final TextTheme textTheme = Theme.of(context).textTheme;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 8),
SelectableText(
title,
style: textTheme.bodyMedium!.copyWith(
fontSize: 16,
color: RallyColors.gray60,
),
),
const SizedBox(height: 8),
SelectableText(
value,
style: textTheme.bodyLarge!.copyWith(fontSize: 20),
),
const SizedBox(height: 8),
Container(
color: RallyColors.primaryBackground,
height: 1,
),
],
);
}
}
| flutter/dev/integration_tests/new_gallery/lib/studies/rally/tabs/sidebar.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/studies/rally/tabs/sidebar.dart",
"repo_id": "flutter",
"token_count": 1099
} | 705 |
// 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 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../../gallery_localizations.dart';
import 'category_menu_page.dart';
import 'page_status.dart';
const Cubic _accelerateCurve = Cubic(0.548, 0, 0.757, 0.464);
const Cubic _decelerateCurve = Cubic(0.23, 0.94, 0.41, 1);
const double _peakVelocityTime = 0.248210;
const double _peakVelocityProgress = 0.379146;
class _FrontLayer extends StatelessWidget {
const _FrontLayer({
this.onTap,
required this.child,
});
final VoidCallback? onTap;
final Widget child;
@override
Widget build(BuildContext context) {
// An area at the top of the product page.
// When the menu page is shown, tapping this area will close the menu
// page and reveal the product page.
final Widget pageTopArea = Container(
height: 40,
alignment: AlignmentDirectional.centerStart,
);
return Material(
elevation: 16,
shape: const BeveledRectangleBorder(
borderRadius:
BorderRadiusDirectional.only(topStart: Radius.circular(46)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
if (onTap != null) MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
excludeFromSemantics:
true, // Because there is already a "Close Menu" button on screen.
onTap: onTap,
child: pageTopArea,
),
) else pageTopArea,
Expanded(
child: child,
),
],
),
);
}
}
class _BackdropTitle extends AnimatedWidget {
const _BackdropTitle({
required Animation<double> super.listenable,
this.onPress,
required this.frontTitle,
required this.backTitle,
});
final void Function()? onPress;
final Widget frontTitle;
final Widget backTitle;
@override
Widget build(BuildContext context) {
final Animation<double> animation = CurvedAnimation(
parent: listenable as Animation<double>,
curve: const Interval(0, 0.78),
);
final int textDirectionScalar =
Directionality.of(context) == TextDirection.ltr ? 1 : -1;
const ImageIcon slantedMenuIcon =
ImageIcon(AssetImage('packages/shrine_images/slanted_menu.png'));
final Widget directionalSlantedMenuIcon =
Directionality.of(context) == TextDirection.ltr
? slantedMenuIcon
: Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(pi),
child: slantedMenuIcon,
);
final String? menuButtonTooltip = animation.isCompleted
? GalleryLocalizations.of(context)!.shrineTooltipOpenMenu
: animation.isDismissed
? GalleryLocalizations.of(context)!.shrineTooltipCloseMenu
: null;
return DefaultTextStyle(
style: Theme.of(context).primaryTextTheme.titleLarge!,
softWrap: false,
overflow: TextOverflow.ellipsis,
child: Row(children: <Widget>[
// branded icon
SizedBox(
width: 72,
child: Semantics(
container: true,
child: IconButton(
padding: const EdgeInsetsDirectional.only(end: 8),
onPressed: onPress,
tooltip: menuButtonTooltip,
icon: Stack(children: <Widget>[
Opacity(
opacity: animation.value,
child: directionalSlantedMenuIcon,
),
FractionalTranslation(
translation: Tween<Offset>(
begin: Offset.zero,
end: Offset(1.0 * textDirectionScalar, 0.0),
).evaluate(animation),
child: const ImageIcon(
AssetImage('packages/shrine_images/diamond.png'),
),
),
]),
),
),
),
// Here, we do a custom cross fade between backTitle and frontTitle.
// This makes a smooth animation between the two texts.
Stack(
children: <Widget>[
Opacity(
opacity: CurvedAnimation(
parent: ReverseAnimation(animation),
curve: const Interval(0.5, 1),
).value,
child: FractionalTranslation(
translation: Tween<Offset>(
begin: Offset.zero,
end: Offset(0.5 * textDirectionScalar, 0),
).evaluate(animation),
child: backTitle,
),
),
Opacity(
opacity: CurvedAnimation(
parent: animation,
curve: const Interval(0.5, 1),
).value,
child: FractionalTranslation(
translation: Tween<Offset>(
begin: Offset(-0.25 * textDirectionScalar, 0),
end: Offset.zero,
).evaluate(animation),
child: frontTitle,
),
),
],
),
]),
);
}
}
/// Builds a Backdrop.
///
/// A Backdrop widget has two layers, front and back. The front layer is shown
/// by default, and slides down to show the back layer, from which a user
/// can make a selection. The user can also configure the titles for when the
/// front or back layer is showing.
class Backdrop extends StatefulWidget {
const Backdrop({
super.key,
required this.frontLayer,
required this.backLayer,
required this.frontTitle,
required this.backTitle,
required this.controller,
});
final Widget frontLayer;
final Widget backLayer;
final Widget frontTitle;
final Widget backTitle;
final AnimationController controller;
@override
State<Backdrop> createState() => _BackdropState();
}
class _BackdropState extends State<Backdrop>
with SingleTickerProviderStateMixin {
final GlobalKey _backdropKey = GlobalKey(debugLabel: 'Backdrop');
late AnimationController _controller;
late Animation<RelativeRect> _layerAnimation;
@override
void initState() {
super.initState();
_controller = widget.controller;
}
bool get _frontLayerVisible {
final AnimationStatus status = _controller.status;
return status == AnimationStatus.completed ||
status == AnimationStatus.forward;
}
void _toggleBackdropLayerVisibility() {
// Call setState here to update layerAnimation if that's necessary
setState(() {
_frontLayerVisible ? _controller.reverse() : _controller.forward();
});
}
// _layerAnimation animates the front layer between open and close.
// _getLayerAnimation adjusts the values in the TweenSequence so the
// curve and timing are correct in both directions.
Animation<RelativeRect> _getLayerAnimation(Size layerSize, double layerTop) {
Curve firstCurve; // Curve for first TweenSequenceItem
Curve secondCurve; // Curve for second TweenSequenceItem
double firstWeight; // Weight of first TweenSequenceItem
double secondWeight; // Weight of second TweenSequenceItem
Animation<double> animation; // Animation on which TweenSequence runs
if (_frontLayerVisible) {
firstCurve = _accelerateCurve;
secondCurve = _decelerateCurve;
firstWeight = _peakVelocityTime;
secondWeight = 1 - _peakVelocityTime;
animation = CurvedAnimation(
parent: _controller.view,
curve: const Interval(0, 0.78),
);
} else {
// These values are only used when the controller runs from t=1.0 to t=0.0
firstCurve = _decelerateCurve.flipped;
secondCurve = _accelerateCurve.flipped;
firstWeight = 1 - _peakVelocityTime;
secondWeight = _peakVelocityTime;
animation = _controller.view;
}
return TweenSequence<RelativeRect>(
<TweenSequenceItem<RelativeRect>>[
TweenSequenceItem<RelativeRect>(
tween: RelativeRectTween(
begin: RelativeRect.fromLTRB(
0,
layerTop,
0,
layerTop - layerSize.height,
),
end: RelativeRect.fromLTRB(
0,
layerTop * _peakVelocityProgress,
0,
(layerTop - layerSize.height) * _peakVelocityProgress,
),
).chain(CurveTween(curve: firstCurve)),
weight: firstWeight,
),
TweenSequenceItem<RelativeRect>(
tween: RelativeRectTween(
begin: RelativeRect.fromLTRB(
0,
layerTop * _peakVelocityProgress,
0,
(layerTop - layerSize.height) * _peakVelocityProgress,
),
end: RelativeRect.fill,
).chain(CurveTween(curve: secondCurve)),
weight: secondWeight,
),
],
).animate(animation);
}
Widget _buildStack(BuildContext context, BoxConstraints constraints) {
const int layerTitleHeight = 48;
final Size layerSize = constraints.biggest;
final double layerTop = layerSize.height - layerTitleHeight;
_layerAnimation = _getLayerAnimation(layerSize, layerTop);
return Stack(
key: _backdropKey,
children: <Widget>[
ExcludeSemantics(
excluding: _frontLayerVisible,
child: widget.backLayer,
),
PositionedTransition(
rect: _layerAnimation,
child: ExcludeSemantics(
excluding: !_frontLayerVisible,
child: AnimatedBuilder(
animation: PageStatus.of(context)!.cartController,
builder: (BuildContext context, Widget? child) => AnimatedBuilder(
animation: PageStatus.of(context)!.menuController,
builder: (BuildContext context, Widget? child) => _FrontLayer(
onTap: menuPageIsVisible(context)
? _toggleBackdropLayerVisibility
: null,
child: widget.frontLayer,
),
),
),
),
),
],
);
}
@override
Widget build(BuildContext context) {
final AppBar appBar = AppBar(
automaticallyImplyLeading: false,
systemOverlayStyle: SystemUiOverlayStyle.dark,
elevation: 0,
titleSpacing: 0,
title: _BackdropTitle(
listenable: _controller.view,
onPress: _toggleBackdropLayerVisibility,
frontTitle: widget.frontTitle,
backTitle: widget.backTitle,
),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.search),
tooltip: GalleryLocalizations.of(context)!.shrineTooltipSearch,
onPressed: () {},
),
IconButton(
icon: const Icon(Icons.tune),
tooltip: GalleryLocalizations.of(context)!.shrineTooltipSettings,
onPressed: () {},
),
],
);
return AnimatedBuilder(
animation: PageStatus.of(context)!.cartController,
builder: (BuildContext context, Widget? child) => ExcludeSemantics(
excluding: cartPageIsVisible(context),
child: Scaffold(
appBar: appBar,
body: LayoutBuilder(
builder: _buildStack,
),
),
),
);
}
}
class DesktopBackdrop extends StatelessWidget {
const DesktopBackdrop({
super.key,
required this.frontLayer,
required this.backLayer,
});
final Widget frontLayer;
final Widget backLayer;
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
backLayer,
Padding(
padding: EdgeInsetsDirectional.only(
start: desktopCategoryMenuPageWidth(context: context),
),
child: Material(
elevation: 16,
color: Colors.white,
child: frontLayer,
),
)
],
);
}
}
| flutter/dev/integration_tests/new_gallery/lib/studies/shrine/backdrop.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/studies/shrine/backdrop.dart",
"repo_id": "flutter",
"token_count": 5406
} | 706 |
// 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 'dart:math';
import 'package:flutter/material.dart';
import '../model/product.dart';
import 'product_card.dart';
/// Height of the text below each product card.
const double productCardAdditionalHeight = 84.0 * 2;
/// Height of the divider between product cards.
const double productCardDividerHeight = 84.0;
/// Height of the space at the top of every other column.
const double columnTopSpace = 84.0;
class DesktopProductCardColumn extends StatelessWidget {
const DesktopProductCardColumn({
super.key,
required this.alignToEnd,
required this.startLarge,
required this.lowerStart,
required this.products,
required this.largeImageWidth,
required this.smallImageWidth,
});
final List<Product> products;
final bool alignToEnd;
final bool startLarge;
final bool lowerStart;
final double largeImageWidth;
final double smallImageWidth;
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
final int currentColumnProductCount = products.length;
final int currentColumnWidgetCount =
max(2 * currentColumnProductCount - 1, 0);
return SizedBox(
width: largeImageWidth,
child: Column(
crossAxisAlignment:
alignToEnd ? CrossAxisAlignment.end : CrossAxisAlignment.start,
children: <Widget>[
if (lowerStart) Container(height: columnTopSpace),
...List<Widget>.generate(currentColumnWidgetCount, (int index) {
Widget card;
if (index.isEven) {
// This is a product.
final int productCardIndex = index ~/ 2;
card = DesktopProductCard(
product: products[productCardIndex],
imageWidth: startLarge
? ((productCardIndex.isEven)
? largeImageWidth
: smallImageWidth)
: ((productCardIndex.isEven)
? smallImageWidth
: largeImageWidth),
);
} else {
// This is just a divider.
card = Container(
height: productCardDividerHeight,
);
}
return RepaintBoundary(child: card);
}),
],
),
);
});
}
}
| flutter/dev/integration_tests/new_gallery/lib/studies/shrine/supplemental/desktop_product_columns.dart/0 | {
"file_path": "flutter/dev/integration_tests/new_gallery/lib/studies/shrine/supplemental/desktop_product_columns.dart",
"repo_id": "flutter",
"token_count": 1105
} | 707 |
name: non_nullable
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.2.0-0 <4.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: 1.0.6
characters: 1.3.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
collection: 1.18.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
material_color_utilities: 0.8.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
meta: 1.12.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_test:
sdk: flutter
async: 2.11.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
boolean_selector: 2.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
clock: 1.1.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
fake_async: 1.3.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker: 10.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_flutter_testing: 3.0.3 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
leak_tracker_testing: 3.0.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
matcher: 0.12.16+1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
path: 1.9.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
source_span: 1.10.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stack_trace: 1.11.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
stream_channel: 2.1.2 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
string_scanner: 1.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
term_glyph: 1.2.1 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
test_api: 0.7.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
vm_service: 14.2.0 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
flutter:
uses-material-design: true
# PUBSPEC CHECKSUM: 2ed7
| flutter/dev/integration_tests/non_nullable/pubspec.yaml/0 | {
"file_path": "flutter/dev/integration_tests/non_nullable/pubspec.yaml",
"repo_id": "flutter",
"token_count": 920
} | 708 |
// 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.
package com.example.release_smoke_test;
import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.instrumentationadapter.FlutterRunner;
import org.junit.Rule;
import org.junit.runner.RunWith;
@RunWith(FlutterRunner.class)
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class);
}
| flutter/dev/integration_tests/release_smoke_test/android/app/src/androidTest/java/com/example/release_smoke_test/MainActivityTest.java/0 | {
"file_path": "flutter/dev/integration_tests/release_smoke_test/android/app/src/androidTest/java/com/example/release_smoke_test/MainActivityTest.java",
"repo_id": "flutter",
"token_count": 157
} | 709 |
// 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/material.dart';
void main() {
runApp(const MaterialApp(home: Test()));
}
class Test extends StatefulWidget {
const Test({ super.key });
@override
State<Test> createState() => _TestState();
}
class _TestState extends State<Test> {
bool _triggered = false;
@override
void reassemble() {
_triggered = true;
super.reassemble();
}
@override
Widget build(BuildContext context) {
if (!_triggered) {
return const SizedBox.shrink();
}
return const Row(children: <Widget>[
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
SizedBox(width: 10000.0),
]);
}
}
| flutter/dev/integration_tests/ui/lib/overflow.dart/0 | {
"file_path": "flutter/dev/integration_tests/ui/lib/overflow.dart",
"repo_id": "flutter",
"token_count": 359
} | 710 |
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"
| flutter/dev/integration_tests/ui/macos/Runner/Configs/Release.xcconfig/0 | {
"file_path": "flutter/dev/integration_tests/ui/macos/Runner/Configs/Release.xcconfig",
"repo_id": "flutter",
"token_count": 32
} | 711 |
// 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_driver/flutter_driver.dart';
import 'package:integration_ui/keys.dart' as keys;
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
void main() {
group('end-to-end test', () {
late FlutterDriver driver;
setUpAll(() async {
driver = await FlutterDriver.connect();
});
tearDownAll(() async {
await driver.close();
});
test('Textfield scrolls back into view after covered by keyboard', () async {
await driver.setTextEntryEmulation(enabled: false); // we want the keyboard to come up
final SerializableFinder listViewFinder = find.byValueKey(keys.kListView);
final SerializableFinder textFieldFinder = find.byValueKey(keys.kDefaultTextField);
final SerializableFinder offsetFinder = find.byValueKey(keys.kOffsetText);
final SerializableFinder keyboardVisibilityIndicatorFinder = find.byValueKey(keys.kKeyboardVisibleView);
// Align TextField with bottom edge to ensure it would be covered when keyboard comes up.
await driver.waitForAbsent(textFieldFinder);
await driver.scrollUntilVisible(
listViewFinder,
textFieldFinder,
alignment: 1.0,
dyScroll: -20.0,
);
await driver.waitFor(textFieldFinder);
final double scrollOffsetWithoutKeyboard = double.parse(await driver.getText(offsetFinder));
// Bring up keyboard
await driver.tap(textFieldFinder);
// The blinking cursor may have animation. Do not wait for it to finish.
await driver.runUnsynchronized(() async {
await driver.waitFor(keyboardVisibilityIndicatorFinder);
});
// Ensure that TextField is visible again
await driver.waitFor(textFieldFinder);
final double scrollOffsetWithKeyboard = double.parse(await driver.getText(offsetFinder));
// Ensure the scroll offset changed appropriately when TextField scrolled back into view.
expect(scrollOffsetWithKeyboard, greaterThan(scrollOffsetWithoutKeyboard));
}, timeout: Timeout.none);
});
}
| flutter/dev/integration_tests/ui/test_driver/keyboard_textfield_test.dart/0 | {
"file_path": "flutter/dev/integration_tests/ui/test_driver/keyboard_textfield_test.dart",
"repo_id": "flutter",
"token_count": 737
} | 712 |
// 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 'dart:html' as html;
// Attempt to load a file that is hosted in the applications's `web/` directory.
Future<void> main() async {
try {
final html.HttpRequest request = await html.HttpRequest.request(
'/example',
method: 'GET',
);
final String? body = request.responseText;
if (body == 'This is an Example') {
print('--- TEST SUCCEEDED ---');
} else {
print('--- TEST FAILED ---');
}
} catch (err) {
print(err);
print('--- TEST FAILED ---');
}
}
| flutter/dev/integration_tests/web/lib/web_directory_loading.dart/0 | {
"file_path": "flutter/dev/integration_tests/web/lib/web_directory_loading.dart",
"repo_id": "flutter",
"token_count": 237
} | 713 |
// 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.
// This file is auto generated.
// To update all the settings.gradle files in the Flutter repo,
// See dev/tools/bin/generate_gradle_lockfiles.dart.
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()
includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
include ":app"
| flutter/dev/manual_tests/android/settings.gradle/0 | {
"file_path": "flutter/dev/manual_tests/android/settings.gradle",
"repo_id": "flutter",
"token_count": 406
} | 714 |
#include "../../Flutter/Flutter-Debug.xcconfig"
#include "Warnings.xcconfig"
| flutter/dev/manual_tests/macos/Runner/Configs/Debug.xcconfig/0 | {
"file_path": "flutter/dev/manual_tests/macos/Runner/Configs/Debug.xcconfig",
"repo_id": "flutter",
"token_count": 32
} | 715 |
// 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 'dart:io';
import 'package:meta/meta.dart';
import 'package:path/path.dart' as path;
/// Makes sure that the path we were given contains some of the expected
/// libraries.
@visibleForTesting
const List<String> dartdocDirectiveCanaryLibraries = <String>[
'animation',
'cupertino',
'material',
'widgets',
'rendering',
'flutter_driver',
];
/// Makes sure that the path we were given contains some of the expected
/// HTML files.
@visibleForTesting
const List<String> dartdocDirectiveCanaryFiles = <String>[
'Widget-class.html',
'Material-class.html',
'Canvas-class.html',
];
/// Scans the dartdoc HTML output in the provided `dartDocDir` for
/// unresolved dartdoc directives (`{@foo x y}`).
///
/// Dartdoc usually replaces those directives with other content. However,
/// if the directive is misspelled (or contains other errors) it is placed
/// verbatim into the HTML output. That's not desirable and this check verifies
/// that no directives appear verbatim in the output by checking that the
/// string `{@` does not appear in the HTML output outside of <code> sections.
///
/// The string `{@` is allowed in <code> sections, because those may contain
/// sample code where the sequence is perfectly legal, e.g. for required named
/// parameters of a method:
///
/// ```
/// void foo({@required int bar});
/// ```
void checkForUnresolvedDirectives(Directory dartDocDir) {
if (!dartDocDir.existsSync()) {
throw Exception('Directory with dartdoc output (${dartDocDir.path}) does not exist.');
}
// Make a copy since this will be mutated
final List<String> canaryLibraries = dartdocDirectiveCanaryLibraries.toList();
final List<String> canaryFiles = dartdocDirectiveCanaryFiles.toList();
print('Scanning for unresolved dartdoc directives...');
final List<FileSystemEntity> toScan = dartDocDir.listSync();
int count = 0;
while (toScan.isNotEmpty) {
final FileSystemEntity entity = toScan.removeLast();
if (entity is File) {
if (path.extension(entity.path) != '.html') {
continue;
}
canaryFiles.remove(path.basename(entity.path));
count += _scanFile(entity);
} else if (entity is Directory) {
canaryLibraries.remove(path.basename(entity.path));
toScan.addAll(entity.listSync());
} else {
throw Exception('$entity is neither file nor directory.');
}
}
if (canaryLibraries.isNotEmpty) {
throw Exception('Did not find docs for the following libraries: ${canaryLibraries.join(', ')}.');
}
if (canaryFiles.isNotEmpty) {
throw Exception('Did not find docs for the following files: ${canaryFiles.join(', ')}.');
}
if (count > 0) {
throw Exception('Found $count unresolved dartdoc directives (see log above).');
}
print('No unresolved dartdoc directives detected.');
}
int _scanFile(File file) {
assert(path.extension(file.path) == '.html');
final Iterable<String> matches = _pattern.allMatches(file.readAsStringSync())
.map((RegExpMatch m ) => m.group(0)!);
if (matches.isNotEmpty) {
stderr.writeln('Found unresolved dartdoc directives in ${file.path}:');
for (final String match in matches) {
stderr.writeln(' $match');
}
}
return matches.length;
}
// Matches all `{@` that are not within `<code></code>` sections.
//
// This regex may lead to false positives if the docs ever contain nested tags
// inside <code> sections. Since we currently don't do that, doing the matching
// with a regex is a lot faster than using an HTML parser to strip out the
// <code> sections.
final RegExp _pattern = RegExp(r'({@[^}\n]*}?)(?![^<>]*</code)');
// Usually, the checker is invoked directly from `dartdoc.dart`. Main method
// is included for convenient local runs without having to regenerate
// the dartdocs every time.
//
// Provide the path to the dartdoc HTML output as an argument when running the
// program.
void main(List<String> args) {
if (args.length != 1) {
throw Exception('Must provide the path to the dartdoc HTML output as argument.');
}
if (!Directory(args.single).existsSync()) {
throw Exception('The dartdoc HTML output directory ${args.single} does not exist.');
}
checkForUnresolvedDirectives(Directory(args.single));
}
| flutter/dev/tools/dartdoc_checker.dart/0 | {
"file_path": "flutter/dev/tools/dartdoc_checker.dart",
"repo_id": "flutter",
"token_count": 1359
} | 716 |
{
"version": "v0_206",
"md.comp.outlined-card.container.color": "surface",
"md.comp.outlined-card.container.elevation": "md.sys.elevation.level0",
"md.comp.outlined-card.container.shadow-color": "shadow",
"md.comp.outlined-card.container.shape": "md.sys.shape.corner.medium",
"md.comp.outlined-card.disabled.container.elevation": "md.sys.elevation.level0",
"md.comp.outlined-card.disabled.outline.color": "outline",
"md.comp.outlined-card.disabled.outline.opacity": 0.12,
"md.comp.outlined-card.dragged.container.elevation": "md.sys.elevation.level3",
"md.comp.outlined-card.dragged.outline.color": "outlineVariant",
"md.comp.outlined-card.dragged.state-layer.color": "onSurface",
"md.comp.outlined-card.dragged.state-layer.opacity": "md.sys.state.dragged.state-layer-opacity",
"md.comp.outlined-card.focus.container.elevation": "md.sys.elevation.level0",
"md.comp.outlined-card.focus.indicator.color": "secondary",
"md.comp.outlined-card.focus.indicator.outline.offset": "md.sys.state.focus-indicator.outer-offset",
"md.comp.outlined-card.focus.indicator.thickness": "md.sys.state.focus-indicator.thickness",
"md.comp.outlined-card.focus.outline.color": "onSurface",
"md.comp.outlined-card.focus.state-layer.color": "onSurface",
"md.comp.outlined-card.focus.state-layer.opacity": "md.sys.state.focus.state-layer-opacity",
"md.comp.outlined-card.hover.container.elevation": "md.sys.elevation.level1",
"md.comp.outlined-card.hover.outline.color": "outlineVariant",
"md.comp.outlined-card.hover.state-layer.color": "onSurface",
"md.comp.outlined-card.hover.state-layer.opacity": "md.sys.state.hover.state-layer-opacity",
"md.comp.outlined-card.icon.color": "primary",
"md.comp.outlined-card.icon.size": 24.0,
"md.comp.outlined-card.outline.color": "outlineVariant",
"md.comp.outlined-card.outline.width": 1.0,
"md.comp.outlined-card.pressed.container.elevation": "md.sys.elevation.level0",
"md.comp.outlined-card.pressed.outline.color": "outlineVariant",
"md.comp.outlined-card.pressed.state-layer.color": "onSurface",
"md.comp.outlined-card.pressed.state-layer.opacity": "md.sys.state.pressed.state-layer-opacity"
}
| flutter/dev/tools/gen_defaults/data/card_outlined.json/0 | {
"file_path": "flutter/dev/tools/gen_defaults/data/card_outlined.json",
"repo_id": "flutter",
"token_count": 852
} | 717 |
{
"version": "v0_206",
"md.comp.extended-fab.primary.container.color": "primaryContainer",
"md.comp.extended-fab.primary.container.elevation": "md.sys.elevation.level3",
"md.comp.extended-fab.primary.container.height": 56.0,
"md.comp.extended-fab.primary.container.shadow-color": "shadow",
"md.comp.extended-fab.primary.container.shape": "md.sys.shape.corner.large",
"md.comp.extended-fab.primary.focus.container.elevation": "md.sys.elevation.level3",
"md.comp.extended-fab.primary.focus.icon.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.focus.indicator.color": "secondary",
"md.comp.extended-fab.primary.focus.indicator.outline.offset": "md.sys.state.focus-indicator.outer-offset",
"md.comp.extended-fab.primary.focus.indicator.thickness": "md.sys.state.focus-indicator.thickness",
"md.comp.extended-fab.primary.focus.label-text.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.focus.state-layer.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.focus.state-layer.opacity": "md.sys.state.focus.state-layer-opacity",
"md.comp.extended-fab.primary.hover.container.elevation": "md.sys.elevation.level4",
"md.comp.extended-fab.primary.hover.icon.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.hover.label-text.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.hover.state-layer.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.hover.state-layer.opacity": "md.sys.state.hover.state-layer-opacity",
"md.comp.extended-fab.primary.icon.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.icon.size": 24.0,
"md.comp.extended-fab.primary.label-text.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.label-text.text-style": "labelLarge",
"md.comp.extended-fab.primary.lowered.container.elevation": "md.sys.elevation.level1",
"md.comp.extended-fab.primary.lowered.focus.container.elevation": "md.sys.elevation.level1",
"md.comp.extended-fab.primary.lowered.hover.container.elevation": "md.sys.elevation.level2",
"md.comp.extended-fab.primary.lowered.pressed.container.elevation": "md.sys.elevation.level1",
"md.comp.extended-fab.primary.pressed.container.elevation": "md.sys.elevation.level3",
"md.comp.extended-fab.primary.pressed.icon.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.pressed.label-text.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.pressed.state-layer.color": "onPrimaryContainer",
"md.comp.extended-fab.primary.pressed.state-layer.opacity": "md.sys.state.pressed.state-layer-opacity"
}
| flutter/dev/tools/gen_defaults/data/fab_extended_primary.json/0 | {
"file_path": "flutter/dev/tools/gen_defaults/data/fab_extended_primary.json",
"repo_id": "flutter",
"token_count": 945
} | 718 |
{
"version": "v0_206",
"md.ref.palette.black": "0xFF000000",
"md.ref.palette.error0": "0xFF000000",
"md.ref.palette.error10": "0xFF410E0B",
"md.ref.palette.error100": "0xFFFFFFFF",
"md.ref.palette.error20": "0xFF601410",
"md.ref.palette.error30": "0xFF8C1D18",
"md.ref.palette.error40": "0xFFB3261E",
"md.ref.palette.error50": "0xFFDC362E",
"md.ref.palette.error60": "0xFFE46962",
"md.ref.palette.error70": "0xFFEC928E",
"md.ref.palette.error80": "0xFFF2B8B5",
"md.ref.palette.error90": "0xFFF9DEDC",
"md.ref.palette.error95": "0xFFFCEEEE",
"md.ref.palette.error99": "0xFFFFFBF9",
"md.ref.palette.neutral0": "0xFF000000",
"md.ref.palette.neutral10": "0xFF1D1B20",
"md.ref.palette.neutral100": "0xFFFFFFFF",
"md.ref.palette.neutral12": "0xFF211F26",
"md.ref.palette.neutral17": "0xFF2B2930",
"md.ref.palette.neutral20": "0xFF322F35",
"md.ref.palette.neutral22": "0xFF36343B",
"md.ref.palette.neutral24": "0xFF3B383E",
"md.ref.palette.neutral30": "0xFF48464C",
"md.ref.palette.neutral4": "0xFF0F0D13",
"md.ref.palette.neutral40": "0xFF605D64",
"md.ref.palette.neutral50": "0xFF79767D",
"md.ref.palette.neutral6": "0xFF141218",
"md.ref.palette.neutral60": "0xFF938F96",
"md.ref.palette.neutral70": "0xFFAEA9B1",
"md.ref.palette.neutral80": "0xFFCAC5CD",
"md.ref.palette.neutral87": "0xFFDED8E1",
"md.ref.palette.neutral90": "0xFFE6E0E9",
"md.ref.palette.neutral92": "0xFFECE6F0",
"md.ref.palette.neutral94": "0xFFF3EDF7",
"md.ref.palette.neutral95": "0xFFF5EFF7",
"md.ref.palette.neutral96": "0xFFF7F2FA",
"md.ref.palette.neutral98": "0xFFFEF7FF",
"md.ref.palette.neutral99": "0xFFFFFBFF",
"md.ref.palette.neutral-variant0": "0xFF000000",
"md.ref.palette.neutral-variant10": "0xFF1D1A22",
"md.ref.palette.neutral-variant100": "0xFFFFFFFF",
"md.ref.palette.neutral-variant20": "0xFF322F37",
"md.ref.palette.neutral-variant30": "0xFF49454F",
"md.ref.palette.neutral-variant40": "0xFF605D66",
"md.ref.palette.neutral-variant50": "0xFF79747E",
"md.ref.palette.neutral-variant60": "0xFF938F99",
"md.ref.palette.neutral-variant70": "0xFFAEA9B4",
"md.ref.palette.neutral-variant80": "0xFFCAC4D0",
"md.ref.palette.neutral-variant90": "0xFFE7E0EC",
"md.ref.palette.neutral-variant95": "0xFFF5EEFA",
"md.ref.palette.neutral-variant99": "0xFFFFFBFE",
"md.ref.palette.primary0": "0xFF000000",
"md.ref.palette.primary10": "0xFF21005D",
"md.ref.palette.primary100": "0xFFFFFFFF",
"md.ref.palette.primary20": "0xFF381E72",
"md.ref.palette.primary30": "0xFF4F378B",
"md.ref.palette.primary40": "0xFF6750A4",
"md.ref.palette.primary50": "0xFF7F67BE",
"md.ref.palette.primary60": "0xFF9A82DB",
"md.ref.palette.primary70": "0xFFB69DF8",
"md.ref.palette.primary80": "0xFFD0BCFF",
"md.ref.palette.primary90": "0xFFEADDFF",
"md.ref.palette.primary95": "0xFFF6EDFF",
"md.ref.palette.primary99": "0xFFFFFBFE",
"md.ref.palette.secondary0": "0xFF000000",
"md.ref.palette.secondary10": "0xFF1D192B",
"md.ref.palette.secondary100": "0xFFFFFFFF",
"md.ref.palette.secondary20": "0xFF332D41",
"md.ref.palette.secondary30": "0xFF4A4458",
"md.ref.palette.secondary40": "0xFF625B71",
"md.ref.palette.secondary50": "0xFF7A7289",
"md.ref.palette.secondary60": "0xFF958DA5",
"md.ref.palette.secondary70": "0xFFB0A7C0",
"md.ref.palette.secondary80": "0xFFCCC2DC",
"md.ref.palette.secondary90": "0xFFE8DEF8",
"md.ref.palette.secondary95": "0xFFF6EDFF",
"md.ref.palette.secondary99": "0xFFFFFBFE",
"md.ref.palette.tertiary0": "0xFF000000",
"md.ref.palette.tertiary10": "0xFF31111D",
"md.ref.palette.tertiary100": "0xFFFFFFFF",
"md.ref.palette.tertiary20": "0xFF492532",
"md.ref.palette.tertiary30": "0xFF633B48",
"md.ref.palette.tertiary40": "0xFF7D5260",
"md.ref.palette.tertiary50": "0xFF986977",
"md.ref.palette.tertiary60": "0xFFB58392",
"md.ref.palette.tertiary70": "0xFFD29DAC",
"md.ref.palette.tertiary80": "0xFFEFB8C8",
"md.ref.palette.tertiary90": "0xFFFFD8E4",
"md.ref.palette.tertiary95": "0xFFFFECF1",
"md.ref.palette.tertiary99": "0xFFFFFBFA",
"md.ref.palette.white": "0xFFFFFFFF"
}
| flutter/dev/tools/gen_defaults/data/palette.json/0 | {
"file_path": "flutter/dev/tools/gen_defaults/data/palette.json",
"repo_id": "flutter",
"token_count": 2020
} | 719 |
{
"version": "v0_206",
"md.comp.time-picker.clock-dial.color": "surfaceContainerHighest",
"md.comp.time-picker.clock-dial.container.size": 256.0,
"md.comp.time-picker.clock-dial.label-text.text-style": "bodyLarge",
"md.comp.time-picker.clock-dial.selected.label-text.color": "onPrimary",
"md.comp.time-picker.clock-dial.selector.center.container.color": "primary",
"md.comp.time-picker.clock-dial.selector.center.container.shape": "md.sys.shape.corner.full",
"md.comp.time-picker.clock-dial.selector.center.container.size": 8.0,
"md.comp.time-picker.clock-dial.selector.handle.container.color": "primary",
"md.comp.time-picker.clock-dial.selector.handle.container.shape": "md.sys.shape.corner.full",
"md.comp.time-picker.clock-dial.selector.handle.container.size": 48.0,
"md.comp.time-picker.clock-dial.selector.track.container.color": "primary",
"md.comp.time-picker.clock-dial.selector.track.container.width": 2.0,
"md.comp.time-picker.clock-dial.shape": "md.sys.shape.corner.full",
"md.comp.time-picker.clock-dial.unselected.label-text.color": "onSurface",
"md.comp.time-picker.container.color": "surfaceContainerHigh",
"md.comp.time-picker.container.elevation": "md.sys.elevation.level3",
"md.comp.time-picker.container.shape": "md.sys.shape.corner.extra-large",
"md.comp.time-picker.headline.color": "onSurfaceVariant",
"md.comp.time-picker.headline.text-style": "labelMedium",
"md.comp.time-picker.period-selector.container.shape": "md.sys.shape.corner.small",
"md.comp.time-picker.period-selector.focus.state-layer.opacity": "md.sys.state.focus.state-layer-opacity",
"md.comp.time-picker.period-selector.horizontal.container.height": 38.0,
"md.comp.time-picker.period-selector.horizontal.container.width": 216.0,
"md.comp.time-picker.period-selector.hover.state-layer.opacity": "md.sys.state.hover.state-layer-opacity",
"md.comp.time-picker.period-selector.label-text.text-style": "titleMedium",
"md.comp.time-picker.period-selector.outline.color": "outline",
"md.comp.time-picker.period-selector.outline.width": 1.0,
"md.comp.time-picker.period-selector.pressed.state-layer.opacity": "md.sys.state.pressed.state-layer-opacity",
"md.comp.time-picker.period-selector.selected.container.color": "tertiaryContainer",
"md.comp.time-picker.period-selector.selected.focus.label-text.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.focus.state-layer.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.hover.label-text.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.hover.state-layer.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.label-text.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.pressed.label-text.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.selected.pressed.state-layer.color": "onTertiaryContainer",
"md.comp.time-picker.period-selector.unselected.focus.label-text.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.focus.state-layer.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.hover.label-text.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.hover.state-layer.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.label-text.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.pressed.label-text.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.unselected.pressed.state-layer.color": "onSurfaceVariant",
"md.comp.time-picker.period-selector.vertical.container.height": 80.0,
"md.comp.time-picker.period-selector.vertical.container.width": 52.0,
"md.comp.time-picker.time-selector.24h-vertical.container.width": 114.0,
"md.comp.time-picker.time-selector.container.height": 80.0,
"md.comp.time-picker.time-selector.container.shape": "md.sys.shape.corner.small",
"md.comp.time-picker.time-selector.container.width": 96.0,
"md.comp.time-picker.time-selector.focus.state-layer.opacity": "md.sys.state.focus.state-layer-opacity",
"md.comp.time-picker.time-selector.hover.state-layer.opacity": "md.sys.state.hover.state-layer-opacity",
"md.comp.time-picker.time-selector.label-text.text-style": "displayLarge",
"md.comp.time-picker.time-selector.pressed.state-layer.opacity": "md.sys.state.pressed.state-layer-opacity",
"md.comp.time-picker.time-selector.selected.container.color": "primaryContainer",
"md.comp.time-picker.time-selector.selected.focus.label-text.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.focus.state-layer.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.hover.label-text.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.hover.state-layer.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.label-text.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.pressed.label-text.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.selected.pressed.state-layer.color": "onPrimaryContainer",
"md.comp.time-picker.time-selector.separator.color": "onSurface",
"md.comp.time-picker.time-selector.separator.text-style": "displayLarge",
"md.comp.time-picker.time-selector.unselected.container.color": "surfaceContainerHighest",
"md.comp.time-picker.time-selector.unselected.focus.label-text.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.focus.state-layer.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.hover.label-text.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.hover.state-layer.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.label-text.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.pressed.label-text.color": "onSurface",
"md.comp.time-picker.time-selector.unselected.pressed.state-layer.color": "onSurface"
}
| flutter/dev/tools/gen_defaults/data/time_picker.json/0 | {
"file_path": "flutter/dev/tools/gen_defaults/data/time_picker.json",
"repo_id": "flutter",
"token_count": 2244
} | 720 |
// 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 'template.dart';
import 'token_logger.dart';
class ColorSchemeTemplate extends TokenTemplate {
ColorSchemeTemplate(this._colorTokensLight, this._colorTokensDark, super.blockName, super.fileName, super.tokens);
// Map of light color scheme token data from tokens.
final Map<String, dynamic> _colorTokensLight;
// Map of dark color scheme token data from tokens.
final Map<String, dynamic> _colorTokensDark;
dynamic light(String tokenName) {
tokenLogger.log(tokenName);
return getToken(_colorTokensLight[tokenName] as String);
}
dynamic dark(String tokenName) {
tokenLogger.log(tokenName);
return getToken(_colorTokensDark[tokenName] as String);
}
@override
String generate() => '''
const ColorScheme _colorSchemeLightM3 = ColorScheme(
brightness: Brightness.light,
primary: Color(${light('md.sys.color.primary')}),
onPrimary: Color(${light('md.sys.color.on-primary')}),
primaryContainer: Color(${light('md.sys.color.primary-container')}),
onPrimaryContainer: Color(${light('md.sys.color.on-primary-container')}),
primaryFixed: Color(${light('md.sys.color.primary-fixed')}),
primaryFixedDim: Color(${light('md.sys.color.primary-fixed-dim')}),
onPrimaryFixed: Color(${light('md.sys.color.on-primary-fixed')}),
onPrimaryFixedVariant: Color(${light('md.sys.color.on-primary-fixed-variant')}),
secondary: Color(${light('md.sys.color.secondary')}),
onSecondary: Color(${light('md.sys.color.on-secondary')}),
secondaryContainer: Color(${light('md.sys.color.secondary-container')}),
onSecondaryContainer: Color(${light('md.sys.color.on-secondary-container')}),
secondaryFixed: Color(${light('md.sys.color.secondary-fixed')}),
secondaryFixedDim: Color(${light('md.sys.color.secondary-fixed-dim')}),
onSecondaryFixed: Color(${light('md.sys.color.on-secondary-fixed')}),
onSecondaryFixedVariant: Color(${light('md.sys.color.on-secondary-fixed-variant')}),
tertiary: Color(${light('md.sys.color.tertiary')}),
onTertiary: Color(${light('md.sys.color.on-tertiary')}),
tertiaryContainer: Color(${light('md.sys.color.tertiary-container')}),
onTertiaryContainer: Color(${light('md.sys.color.on-tertiary-container')}),
tertiaryFixed: Color(${light('md.sys.color.tertiary-fixed')}),
tertiaryFixedDim: Color(${light('md.sys.color.tertiary-fixed-dim')}),
onTertiaryFixed: Color(${light('md.sys.color.on-tertiary-fixed')}),
onTertiaryFixedVariant: Color(${light('md.sys.color.on-tertiary-fixed-variant')}),
error: Color(${light('md.sys.color.error')}),
onError: Color(${light('md.sys.color.on-error')}),
errorContainer: Color(${light('md.sys.color.error-container')}),
onErrorContainer: Color(${light('md.sys.color.on-error-container')}),
background: Color(${light('md.sys.color.background')}),
onBackground: Color(${light('md.sys.color.on-background')}),
surface: Color(${light('md.sys.color.surface')}),
surfaceBright: Color(${light('md.sys.color.surface-bright')}),
surfaceContainerLowest: Color(${light('md.sys.color.surface-container-lowest')}),
surfaceContainerLow: Color(${light('md.sys.color.surface-container-low')}),
surfaceContainer: Color(${light('md.sys.color.surface-container')}),
surfaceContainerHigh: Color(${light('md.sys.color.surface-container-high')}),
surfaceContainerHighest: Color(${light('md.sys.color.surface-container-highest')}),
surfaceDim: Color(${light('md.sys.color.surface-dim')}),
onSurface: Color(${light('md.sys.color.on-surface')}),
surfaceVariant: Color(${light('md.sys.color.surface-variant')}),
onSurfaceVariant: Color(${light('md.sys.color.on-surface-variant')}),
outline: Color(${light('md.sys.color.outline')}),
outlineVariant: Color(${light('md.sys.color.outline-variant')}),
shadow: Color(${light('md.sys.color.shadow')}),
scrim: Color(${light('md.sys.color.scrim')}),
inverseSurface: Color(${light('md.sys.color.inverse-surface')}),
onInverseSurface: Color(${light('md.sys.color.inverse-on-surface')}),
inversePrimary: Color(${light('md.sys.color.inverse-primary')}),
// The surfaceTint color is set to the same color as the primary.
surfaceTint: Color(${light('md.sys.color.primary')}),
);
const ColorScheme _colorSchemeDarkM3 = ColorScheme(
brightness: Brightness.dark,
primary: Color(${dark('md.sys.color.primary')}),
onPrimary: Color(${dark('md.sys.color.on-primary')}),
primaryContainer: Color(${dark('md.sys.color.primary-container')}),
onPrimaryContainer: Color(${dark('md.sys.color.on-primary-container')}),
primaryFixed: Color(${dark('md.sys.color.primary-fixed')}),
primaryFixedDim: Color(${dark('md.sys.color.primary-fixed-dim')}),
onPrimaryFixed: Color(${dark('md.sys.color.on-primary-fixed')}),
onPrimaryFixedVariant: Color(${dark('md.sys.color.on-primary-fixed-variant')}),
secondary: Color(${dark('md.sys.color.secondary')}),
onSecondary: Color(${dark('md.sys.color.on-secondary')}),
secondaryContainer: Color(${dark('md.sys.color.secondary-container')}),
onSecondaryContainer: Color(${dark('md.sys.color.on-secondary-container')}),
secondaryFixed: Color(${dark('md.sys.color.secondary-fixed')}),
secondaryFixedDim: Color(${dark('md.sys.color.secondary-fixed-dim')}),
onSecondaryFixed: Color(${dark('md.sys.color.on-secondary-fixed')}),
onSecondaryFixedVariant: Color(${dark('md.sys.color.on-secondary-fixed-variant')}),
tertiary: Color(${dark('md.sys.color.tertiary')}),
onTertiary: Color(${dark('md.sys.color.on-tertiary')}),
tertiaryContainer: Color(${dark('md.sys.color.tertiary-container')}),
onTertiaryContainer: Color(${dark('md.sys.color.on-tertiary-container')}),
tertiaryFixed: Color(${dark('md.sys.color.tertiary-fixed')}),
tertiaryFixedDim: Color(${dark('md.sys.color.tertiary-fixed-dim')}),
onTertiaryFixed: Color(${dark('md.sys.color.on-tertiary-fixed')}),
onTertiaryFixedVariant: Color(${dark('md.sys.color.on-tertiary-fixed-variant')}),
error: Color(${dark('md.sys.color.error')}),
onError: Color(${dark('md.sys.color.on-error')}),
errorContainer: Color(${dark('md.sys.color.error-container')}),
onErrorContainer: Color(${dark('md.sys.color.on-error-container')}),
background: Color(${dark('md.sys.color.background')}),
onBackground: Color(${dark('md.sys.color.on-background')}),
surface: Color(${dark('md.sys.color.surface')}),
surfaceBright: Color(${dark('md.sys.color.surface-bright')}),
surfaceContainerLowest: Color(${dark('md.sys.color.surface-container-lowest')}),
surfaceContainerLow: Color(${dark('md.sys.color.surface-container-low')}),
surfaceContainer: Color(${dark('md.sys.color.surface-container')}),
surfaceContainerHigh: Color(${dark('md.sys.color.surface-container-high')}),
surfaceContainerHighest: Color(${dark('md.sys.color.surface-container-highest')}),
surfaceDim: Color(${dark('md.sys.color.surface-dim')}),
onSurface: Color(${dark('md.sys.color.on-surface')}),
surfaceVariant: Color(${dark('md.sys.color.surface-variant')}),
onSurfaceVariant: Color(${dark('md.sys.color.on-surface-variant')}),
outline: Color(${dark('md.sys.color.outline')}),
outlineVariant: Color(${dark('md.sys.color.outline-variant')}),
shadow: Color(${dark('md.sys.color.shadow')}),
scrim: Color(${dark('md.sys.color.scrim')}),
inverseSurface: Color(${dark('md.sys.color.inverse-surface')}),
onInverseSurface: Color(${dark('md.sys.color.inverse-on-surface')}),
inversePrimary: Color(${dark('md.sys.color.inverse-primary')}),
// The surfaceTint color is set to the same color as the primary.
surfaceTint: Color(${dark('md.sys.color.primary')}),
);
''';
}
| flutter/dev/tools/gen_defaults/lib/color_scheme_template.dart/0 | {
"file_path": "flutter/dev/tools/gen_defaults/lib/color_scheme_template.dart",
"repo_id": "flutter",
"token_count": 2708
} | 721 |
// 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 'template.dart';
class NavigationRailTemplate extends TokenTemplate {
const NavigationRailTemplate(super.blockName, super.fileName, super.tokens, {
super.colorSchemePrefix = '_colors.',
super.textThemePrefix = '_textTheme.',
});
@override
String generate() => '''
class _${blockName}DefaultsM3 extends NavigationRailThemeData {
_${blockName}DefaultsM3(this.context)
: super(
elevation: ${elevation("md.comp.navigation-rail.container")},
groupAlignment: -1,
labelType: NavigationRailLabelType.none,
useIndicator: true,
minWidth: ${getToken('md.comp.navigation-rail.container.width')},
minExtendedWidth: 256,
);
final BuildContext context;
late final ColorScheme _colors = Theme.of(context).colorScheme;
late final TextTheme _textTheme = Theme.of(context).textTheme;
@override Color? get backgroundColor => ${componentColor("md.comp.navigation-rail.container")};
@override TextStyle? get unselectedLabelTextStyle {
return ${textStyle("md.comp.navigation-rail.label-text")}!.copyWith(color: ${componentColor("md.comp.navigation-rail.inactive.focus.label-text")});
}
@override TextStyle? get selectedLabelTextStyle {
return ${textStyle("md.comp.navigation-rail.label-text")}!.copyWith(color: ${componentColor("md.comp.navigation-rail.active.focus.label-text")});
}
@override IconThemeData? get unselectedIconTheme {
return IconThemeData(
size: ${getToken("md.comp.navigation-rail.icon.size")},
color: ${componentColor("md.comp.navigation-rail.inactive.icon")},
);
}
@override IconThemeData? get selectedIconTheme {
return IconThemeData(
size: ${getToken("md.comp.navigation-rail.icon.size")},
color: ${componentColor("md.comp.navigation-rail.active.icon")},
);
}
@override Color? get indicatorColor => ${componentColor("md.comp.navigation-rail.active-indicator")};
@override ShapeBorder? get indicatorShape => ${shape("md.comp.navigation-rail.active-indicator")};
}
''';
}
| flutter/dev/tools/gen_defaults/lib/navigation_rail_template.dart/0 | {
"file_path": "flutter/dev/tools/gen_defaults/lib/navigation_rail_template.dart",
"repo_id": "flutter",
"token_count": 747
} | 722 |
// 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 'template.dart';
class TypographyTemplate extends TokenTemplate {
const TypographyTemplate(super.blockName, super.fileName, super.tokens);
@override
String generate() => '''
abstract final class _M3Typography {
${_textTheme('englishLike', 'alphabetic')}
${_textTheme('dense', 'ideographic')}
${_textTheme('tall', 'alphabetic')}
}
''';
String _textTheme(String name, String baseline) {
final StringBuffer theme = StringBuffer('static const TextTheme $name = TextTheme(\n');
theme.writeln(' displayLarge: ${_textStyleDef('md.sys.typescale.display-large', '$name displayLarge 2021', baseline)},');
theme.writeln(' displayMedium: ${_textStyleDef('md.sys.typescale.display-medium', '$name displayMedium 2021', baseline)},');
theme.writeln(' displaySmall: ${_textStyleDef('md.sys.typescale.display-small', '$name displaySmall 2021', baseline)},');
theme.writeln(' headlineLarge: ${_textStyleDef('md.sys.typescale.headline-large', '$name headlineLarge 2021', baseline)},');
theme.writeln(' headlineMedium: ${_textStyleDef('md.sys.typescale.headline-medium', '$name headlineMedium 2021', baseline)},');
theme.writeln(' headlineSmall: ${_textStyleDef('md.sys.typescale.headline-small', '$name headlineSmall 2021', baseline)},');
theme.writeln(' titleLarge: ${_textStyleDef('md.sys.typescale.title-large', '$name titleLarge 2021', baseline)},');
theme.writeln(' titleMedium: ${_textStyleDef('md.sys.typescale.title-medium', '$name titleMedium 2021', baseline)},');
theme.writeln(' titleSmall: ${_textStyleDef('md.sys.typescale.title-small', '$name titleSmall 2021', baseline)},');
theme.writeln(' labelLarge: ${_textStyleDef('md.sys.typescale.label-large', '$name labelLarge 2021', baseline)},');
theme.writeln(' labelMedium: ${_textStyleDef('md.sys.typescale.label-medium', '$name labelMedium 2021', baseline)},');
theme.writeln(' labelSmall: ${_textStyleDef('md.sys.typescale.label-small', '$name labelSmall 2021', baseline)},');
theme.writeln(' bodyLarge: ${_textStyleDef('md.sys.typescale.body-large', '$name bodyLarge 2021', baseline)},');
theme.writeln(' bodyMedium: ${_textStyleDef('md.sys.typescale.body-medium', '$name bodyMedium 2021', baseline)},');
theme.writeln(' bodySmall: ${_textStyleDef('md.sys.typescale.body-small', '$name bodySmall 2021', baseline)},');
theme.write(' );');
return theme.toString();
}
String _textStyleDef(String tokenPrefix, String debugLabel, String baseline) {
final StringBuffer style = StringBuffer("TextStyle(debugLabel: '$debugLabel'");
style.write(', inherit: false');
style.write(', fontSize: ${_fontSize(tokenPrefix)}');
style.write(', fontWeight: ${_fontWeight(tokenPrefix)}');
style.write(', letterSpacing: ${_fontSpacing(tokenPrefix)}');
style.write(', height: ${_fontHeight(tokenPrefix)}');
style.write(', textBaseline: TextBaseline.$baseline');
style.write(', leadingDistribution: TextLeadingDistribution.even');
style.write(')');
return style.toString();
}
String _fontSize(String textStyleTokenName) {
return getToken('$textStyleTokenName.size').toString();
}
String _fontWeight(String textStyleTokenName) {
final String weightValue = getToken(getToken('$textStyleTokenName.weight') as String).toString();
return 'FontWeight.w$weightValue';
}
String _fontSpacing(String textStyleTokenName) {
return getToken('$textStyleTokenName.tracking').toString();
}
String _fontHeight(String textStyleTokenName) {
final double size = getToken('$textStyleTokenName.size') as double;
final double lineHeight = getToken('$textStyleTokenName.line-height') as double;
return (lineHeight / size).toStringAsFixed(2);
}
}
| flutter/dev/tools/gen_defaults/lib/typography_template.dart/0 | {
"file_path": "flutter/dev/tools/gen_defaults/lib/typography_template.dart",
"repo_id": "flutter",
"token_count": 1309
} | 723 |
{
"NumpadAdd": ["KP_Add"],
"NumpadMultiply": ["KP_Multiply"],
"NumpadSubtract": ["KP_Subtract"],
"NumpadDivide": ["KP_Divide"],
"Space": ["KP_Space"],
"Period": ["KP_Decimal"],
"NumpadEqual": ["KP_Equal"],
"Numpad0": ["KP_0", "KP_Insert"],
"Numpad1": ["KP_1", "KP_End"],
"Numpad2": ["KP_2", "KP_Down"],
"Numpad3": ["KP_3", "KP_Page_Down"],
"Numpad4": ["KP_4", "KP_Left"],
"Numpad5": ["KP_5"],
"Numpad6": ["KP_6", "KP_Right"],
"Numpad7": ["KP_7", "KP_Home"],
"Numpad8": ["KP_8", "KP_Up"],
"Numpad9": ["KP_9", "KP_Page_Up"],
"NumpadDecimal": ["KP_Period", "KP_Delete"],
"NumpadEnter": ["KP_Enter"],
"AltLeft": ["Alt_L"],
"AltRight": ["Alt_R", "ISO_Level3_Shift"],
"ArrowDown": ["Down"],
"ArrowLeft": ["Left"],
"ArrowRight": ["Right"],
"ArrowUp": ["Up"],
"Attn": ["3270_Attn"],
"AudioVolumeDown": ["AudioLowerVolume"],
"AudioVolumeMute": ["AudioMute"],
"AudioVolumeUp": ["AudioRaiseVolume"],
"Backspace": ["BackSpace"],
"BrightnessDown": ["MonBrightnessDown"],
"BrightnessUp": ["MonBrightnessUp"],
"BrowserBack": ["Back"],
"BrowserFavorites": ["Favorites"],
"BrowserFavourites": ["Favourites"],
"BrowserForward": ["Forward"],
"BrowserHome": ["HomePage"],
"BrowserRefresh": ["Refresh"],
"BrowserSearch": ["Search"],
"BrowserStop": ["Stop"],
"Cancel": ["Cancel"],
"CapsLock": ["Caps_Lock"],
"Clear": ["Clear"],
"Close": ["Close"],
"CodeInput": ["Codeinput"],
"ContextMenu": ["Menu"],
"ControlLeft": ["Control_L"],
"ControlRight": ["Control_R"],
"Copy": ["Copy", "3270_Copy"],
"Cut": ["Cut"],
"Delete": ["Delete"],
"Eisu": ["Eisu_Shift"],
"Eject": ["Eject"],
"End": ["End"],
"Enter": ["Return", "3270_Enter", "ISO_Enter"],
"EraseEof": ["3270_EraseEOF"],
"Escape": ["Escape"],
"ExSel": ["3270_ExSelect"],
"Execute": ["Execute"],
"F1": ["F1", "KP_F1"],
"F2": ["F2", "KP_F2"],
"F3": ["F3", "KP_F3"],
"F4": ["F4", "KP_F4"],
"F5": ["F5"],
"F6": ["F6"],
"F7": ["F7"],
"F8": ["F8"],
"F9": ["F9"],
"F10": ["F10"],
"F11": ["F11"],
"F12": ["F12"],
"F13": ["F13"],
"F14": ["F14"],
"F15": ["F15"],
"F16": ["F16"],
"F17": ["F17"],
"F18": ["F18"],
"F19": ["F19"],
"F20": ["F20"],
"F21": ["F21"],
"F22": ["F22"],
"F23": ["F23"],
"F24": ["F24"],
"F25": ["F25"],
"Find": ["Find"],
"GroupFirst": ["ISO_First_Group"],
"GroupLast": ["ISO_Last_Group"],
"GroupNext": ["ISO_Next_Group"],
"GroupPrevious": ["ISO_Prev_Group"],
"HangulMode": ["Hangul"],
"HanjaMode": ["Hangul_Hanja"],
"Hankaku": ["Hankaku"],
"Help": ["Help"],
"Hiragana": ["Hiragana"],
"HiraganaKatakana": ["Hiragana_Katakana"],
"Home": ["Home"],
"Hybernate": ["Hybernate"],
"Hyper": ["Hyper_L", "Hyper_R"],
"Insert": ["Insert"],
"IntlYen": ["yen"],
"KanjiMode": ["Kanji"],
"Katakana": ["Katakana"],
"LaunchAudioBrowser": ["Music"],
"LaunchCalendar": ["Calendar"],
"LaunchDocuments": ["Document"],
"LaunchInternetBrowser": ["WWW"],
"LaunchMail": ["Mail"],
"LaunchPhone": ["Phone"],
"LaunchScreenSaver": ["ScreenSaver"],
"LogOff": ["LogOff"],
"MailForward": ["MailForward"],
"MailReply": ["Reply"],
"MailSend": ["Send"],
"MediaFastForward": ["AudioForward"],
"MediaPause": ["AudioPause"],
"MediaPlay": ["AudioPlay", "3270_Play"],
"MediaRecord": ["AudioRecord"],
"MediaRewind": ["AudioRewind"],
"MediaStop": ["AudioStop"],
"MediaTrackNext": ["AudioNext"],
"MediaTrackPrevious": ["AudioPrev"],
"MetaLeft": ["Meta_L"],
"MetaRight": ["Meta_R"],
"ModeChange": ["Mode_switch"],
"New": ["New"],
"NumLock": ["Num_Lock"],
"Open": ["Open"],
"PageDown": ["Page_Down"],
"PageUp": ["Page_Up"],
"Paste": ["Paste"],
"Pause": ["Pause"],
"PowerOff": ["PowerOff"],
"PreviousCandidate": ["PreviousCandidate"],
"Print": ["Print"],
"PrintScreen": ["3270_PrintScreen"],
"Redo": ["Redo"],
"Resume": ["Resume"],
"Romaji": ["Romaji"],
"Save": ["Save"],
"ScrollLock": ["Scroll_Lock"],
"Select": ["Select"],
"ShiftLeft": ["Shift_L"],
"ShiftRight": ["Shift_R"],
"SingleCandidate": ["SingleCandidate"],
"Sleep": ["Sleep"],
"SpellCheck": ["Spell"],
"Standby": ["Standby"],
"Super": ["Super_L", "Super_R"],
"Suspend": ["Suspend"],
"Tab": ["Tab", "KP_Tab", "ISO_Left_Tab"],
"Undo": ["Undo"],
"WakeUp": ["WakeUp"],
"Zenkaku": ["Zenkaku"],
"ZenkakuHankaku": ["Zenkaku_Hankaku"],
"ZoomIn": ["ZoomIn"],
"ZoomOut": ["ZoomOut"]
}
| flutter/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json/0 | {
"file_path": "flutter/dev/tools/gen_keycodes/data/gtk_logical_name_mapping.json",
"repo_id": "flutter",
"token_count": 1881
} | 724 |
// This file contains supplemental key data to be added to those that
// Chromium defines.
// ============================================================
// Printable keys (Unicode plane)
// ============================================================
// Key Enum Unicode code point
DOM_KEY_UNI("Space", SPACE, ' '),
DOM_KEY_UNI("Exclamation", EXCLAMATION, '!'),
DOM_KEY_UNI("NumberSign", NUMBER_SIGN, '#'),
DOM_KEY_UNI("Dollar", DOLLAR, '$'),
DOM_KEY_UNI("Percent", PERCENT, '%'),
DOM_KEY_UNI("Ampersand", AMPERSAND, '&'),
DOM_KEY_UNI("QuoteSingle", QUOTE_SINGLE, 0x0027),
DOM_KEY_UNI("Quote", QUOTE, '"')",
DOM_KEY_UNI("ParenthesisLeft", PARENTHESIS_LEFT, '('),
DOM_KEY_UNI("ParenthesisRight", PARENTHESIS_RIGHT, ')'),
DOM_KEY_UNI("Asterisk", ASTERISK, '*'),
DOM_KEY_UNI("Add", ADD, '+'),
DOM_KEY_UNI("Comma", COMMA, ','),
DOM_KEY_UNI("Minus", MINUS, '-'),
DOM_KEY_UNI("Period", PERIOD, '.'),
DOM_KEY_UNI("Slash", SLASH, '/'),
DOM_KEY_UNI("Digit0", DIGIT0, '0'),
DOM_KEY_UNI("Digit1", DIGIT1, '1'),
DOM_KEY_UNI("Digit2", DIGIT2, '2'),
DOM_KEY_UNI("Digit3", DIGIT3, '3'),
DOM_KEY_UNI("Digit4", DIGIT4, '4'),
DOM_KEY_UNI("Digit5", DIGIT5, '5'),
DOM_KEY_UNI("Digit6", DIGIT6, '6'),
DOM_KEY_UNI("Digit7", DIGIT7, '7'),
DOM_KEY_UNI("Digit8", DIGIT8, '8'),
DOM_KEY_UNI("Digit9", DIGIT9, '9'),
DOM_KEY_UNI("Colon", COLON, ':'),
DOM_KEY_UNI("Semicolon", SEMICOLON, ';'),
DOM_KEY_UNI("Less", LESS, '<'),
DOM_KEY_UNI("Equal", EQUAL, '='),
DOM_KEY_UNI("Greater", GREATER, '>'),
DOM_KEY_UNI("Question", QUESTION, '?'),
DOM_KEY_UNI("At", AT, '@'),
DOM_KEY_UNI("BracketLeft", BRACKET_LEFT, '['),
DOM_KEY_UNI("Backslash", BACKSLASH, 0x005c),
DOM_KEY_UNI("BracketRight", BRACKET_RIGHT, ']'),
DOM_KEY_UNI("Caret", CARET, '^'),
DOM_KEY_UNI("Backquote", BACKQUOTE, '`'),
DOM_KEY_UNI("Underscore", UNDERSCORE, '_'),
DOM_KEY_UNI("KeyA", KEY_A, 'a'),
DOM_KEY_UNI("KeyB", KEY_B, 'b'),
DOM_KEY_UNI("KeyC", KEY_C, 'c'),
DOM_KEY_UNI("KeyD", KEY_D, 'd'),
DOM_KEY_UNI("KeyE", KEY_E, 'e'),
DOM_KEY_UNI("KeyF", KEY_F, 'f'),
DOM_KEY_UNI("KeyG", KEY_G, 'g'),
DOM_KEY_UNI("KeyH", KEY_H, 'h'),
DOM_KEY_UNI("KeyI", KEY_I, 'i'),
DOM_KEY_UNI("KeyJ", KEY_J, 'j'),
DOM_KEY_UNI("KeyK", KEY_K, 'k'),
DOM_KEY_UNI("KeyL", KEY_L, 'l'),
DOM_KEY_UNI("KeyM", KEY_M, 'm'),
DOM_KEY_UNI("KeyN", KEY_N, 'n'),
DOM_KEY_UNI("KeyO", KEY_O, 'o'),
DOM_KEY_UNI("KeyP", KEY_P, 'p'),
DOM_KEY_UNI("KeyQ", KEY_Q, 'q'),
DOM_KEY_UNI("KeyR", KEY_R, 'r'),
DOM_KEY_UNI("KeyS", KEY_S, 's'),
DOM_KEY_UNI("KeyT", KEY_T, 't'),
DOM_KEY_UNI("KeyU", KEY_U, 'u'),
DOM_KEY_UNI("KeyV", KEY_V, 'v'),
DOM_KEY_UNI("KeyW", KEY_W, 'w'),
DOM_KEY_UNI("KeyX", KEY_X, 'x'),
DOM_KEY_UNI("KeyY", KEY_Y, 'y'),
DOM_KEY_UNI("KeyZ", KEY_Z, 'z'),
DOM_KEY_UNI("BraceLeft", BRACE_LEFT, '{'),
DOM_KEY_UNI("BraceRight", BRACE_RIGHT, '}'),
DOM_KEY_UNI("Tilde", TILDE, '~'),
DOM_KEY_UNI("Bar", BAR, '|'),
// ============================================================
// Unprintable keys (Unicode plane)
// ============================================================
// Key Enum Value
// Sometimes the Escape key produces "Esc" instead of "Escape". This includes
// older IE and Firefox browsers, and the current Cobalt browser.
// See: https://github.com/flutter/flutter/issues/106062
DOM_KEY_MAP("Esc", ESC, 0x1B),
// The following keys reside in the Flutter plane (0x0100000000).
// ============================================================
// Miscellaneous (0x000__)
// ============================================================
// Key Enum Value
FLUTTER_KEY_MAP("Suspend", SUSPEND, 0x00000),
FLUTTER_KEY_MAP("Resume", RESUME, 0x00001),
FLUTTER_KEY_MAP("Sleep", SLEEP, 0x00002),
FLUTTER_KEY_MAP("Abort", ABORT, 0x00003),
FLUTTER_KEY_MAP("Lang1", LANG1, 0x00010),
FLUTTER_KEY_MAP("Lang2", LANG2, 0x00011),
FLUTTER_KEY_MAP("Lang3", LANG3, 0x00012),
FLUTTER_KEY_MAP("Lang4", LANG4, 0x00013),
FLUTTER_KEY_MAP("Lang5", LANG5, 0x00014),
FLUTTER_KEY_MAP("IntlBackslash", INTL_BACKSLASH, 0x00020),
FLUTTER_KEY_MAP("IntlRo", INTL_RO, 0x00021),
FLUTTER_KEY_MAP("IntlYen", INTL_YEN, 0x00022),
// ============================================================
// Modifiers (0x001__)
// ============================================================
// Key Enum Value
FLUTTER_KEY_MAP("ControlLeft", CONTROL_LEFT, 0x00100),
FLUTTER_KEY_MAP("ControlRight", CONTROL_RIGHT, 0x00101),
FLUTTER_KEY_MAP("ShiftLeft", SHIFT_LEFT, 0x00102),
FLUTTER_KEY_MAP("ShiftRight", SHIFT_RIGHT, 0x00103),
FLUTTER_KEY_MAP("AltLeft", ALT_LEFT, 0x00104),
FLUTTER_KEY_MAP("AltRight", ALT_RIGHT, 0x00105),
FLUTTER_KEY_MAP("MetaLeft", META_LEFT, 0x00106),
FLUTTER_KEY_MAP("MetaRight", META_RIGHT, 0x00107),
// Synonym keys are added for compatibility and will be removed in the future.
FLUTTER_KEY_MAP("Control", CONTROL, 0x001F0),
FLUTTER_KEY_MAP("Shift", SHIFT, 0x001F2),
FLUTTER_KEY_MAP("Alt", ALT, 0x001F4),
FLUTTER_KEY_MAP("Meta", META, 0x001F6),
// ============================================================
// Number pad (0x002__)
// ============================================================
// The value for number pad buttons are derived from their unicode code
// points.
FLUTTER_KEY_MAP("NumpadEnter", NUMPAD_ENTER, 0x0020D),
FLUTTER_KEY_MAP("NumpadParenLeft", NUMPAD_PAREN_LEFT, 0x00228),
FLUTTER_KEY_MAP("NumpadParenRight", NUMPAD_PAREN_RIGHT, 0x00229),
FLUTTER_KEY_MAP("NumpadMultiply", NUMPAD_MULTIPLY, 0x0022A),
FLUTTER_KEY_MAP("NumpadAdd", NUMPAD_ADD, 0x0022B),
FLUTTER_KEY_MAP("NumpadComma", NUMPAD_COMMA, 0x0022C),
FLUTTER_KEY_MAP("NumpadSubtract", NUMPAD_SUBTRACT, 0x0022D),
FLUTTER_KEY_MAP("NumpadDecimal", NUMPAD_DECIMAL, 0x0022E),
FLUTTER_KEY_MAP("NumpadDivide", NUMPAD_DIVIDE, 0x0022F),
FLUTTER_KEY_MAP("Numpad0", NUMPAD_0, 0x00230),
FLUTTER_KEY_MAP("Numpad1", NUMPAD_1, 0x00231),
FLUTTER_KEY_MAP("Numpad2", NUMPAD_2, 0x00232),
FLUTTER_KEY_MAP("Numpad3", NUMPAD_3, 0x00233),
FLUTTER_KEY_MAP("Numpad4", NUMPAD_4, 0x00234),
FLUTTER_KEY_MAP("Numpad5", NUMPAD_5, 0x00235),
FLUTTER_KEY_MAP("Numpad6", NUMPAD_6, 0x00236),
FLUTTER_KEY_MAP("Numpad7", NUMPAD_7, 0x00237),
FLUTTER_KEY_MAP("Numpad8", NUMPAD_8, 0x00238),
FLUTTER_KEY_MAP("Numpad9", NUMPAD_9, 0x00239),
FLUTTER_KEY_MAP("NumpadEqual", NUMPAD_EQUAL, 0x0023D),
// ============================================================
// Game controller buttons (0x003__)
// ============================================================
// The value for game controller buttons are derived from the last 8 bit
// of its USB HID usage.
// Key Enum Value
FLUTTER_KEY_MAP("GameButton1", GAME_BUTTON_1, 0x00301),
FLUTTER_KEY_MAP("GameButton2", GAME_BUTTON_2, 0x00302),
FLUTTER_KEY_MAP("GameButton3", GAME_BUTTON_3, 0x00303),
FLUTTER_KEY_MAP("GameButton4", GAME_BUTTON_4, 0x00304),
FLUTTER_KEY_MAP("GameButton5", GAME_BUTTON_5, 0x00305),
FLUTTER_KEY_MAP("GameButton6", GAME_BUTTON_6, 0x00306),
FLUTTER_KEY_MAP("GameButton7", GAME_BUTTON_7, 0x00307),
FLUTTER_KEY_MAP("GameButton8", GAME_BUTTON_8, 0x00308),
FLUTTER_KEY_MAP("GameButton9", GAME_BUTTON_9, 0x00309),
FLUTTER_KEY_MAP("GameButton10", GAME_BUTTON_10, 0x0030a),
FLUTTER_KEY_MAP("GameButton11", GAME_BUTTON_11, 0x0030b),
FLUTTER_KEY_MAP("GameButton12", GAME_BUTTON_12, 0x0030c),
FLUTTER_KEY_MAP("GameButton13", GAME_BUTTON_13, 0x0030d),
FLUTTER_KEY_MAP("GameButton14", GAME_BUTTON_14, 0x0030e),
FLUTTER_KEY_MAP("GameButton15", GAME_BUTTON_15, 0x0030f),
FLUTTER_KEY_MAP("GameButton16", GAME_BUTTON_16, 0x00310),
FLUTTER_KEY_MAP("GameButtonA", GAME_BUTTON_A, 0x00311),
FLUTTER_KEY_MAP("GameButtonB", GAME_BUTTON_B, 0x00312),
FLUTTER_KEY_MAP("GameButtonC", GAME_BUTTON_C, 0x00313),
FLUTTER_KEY_MAP("GameButtonLeft1", GAME_BUTTON_L1, 0x00314),
FLUTTER_KEY_MAP("GameButtonLeft2", GAME_BUTTON_L2, 0x00315),
FLUTTER_KEY_MAP("GameButtonMode", GAME_BUTTON_MODE, 0x00316),
FLUTTER_KEY_MAP("GameButtonRight1", GAME_BUTTON_R1, 0x00317),
FLUTTER_KEY_MAP("GameButtonRight2", GAME_BUTTON_R2, 0x00318),
FLUTTER_KEY_MAP("GameButtonSelect", GAME_BUTTON_SELECT, 0x00319),
FLUTTER_KEY_MAP("GameButtonStart", GAME_BUTTON_START, 0x0031a),
FLUTTER_KEY_MAP("GameButtonThumbLeft", GAME_BUTTON_THUMBL, 0x0031b),
FLUTTER_KEY_MAP("GameButtonThumbRight", GAME_BUTTON_THUMBR, 0x0031c),
FLUTTER_KEY_MAP("GameButtonX", GAME_BUTTON_X, 0x0031d),
FLUTTER_KEY_MAP("GameButtonY", GAME_BUTTON_Y, 0x0031e),
FLUTTER_KEY_MAP("GameButtonZ", GAME_BUTTON_Z, 0x0031f),
| flutter/dev/tools/gen_keycodes/data/supplemental_key_data.inc/0 | {
"file_path": "flutter/dev/tools/gen_keycodes/data/supplemental_key_data.inc",
"repo_id": "flutter",
"token_count": 7847
} | 725 |
// 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:path/path.dart' as path;
import 'base_code_gen.dart';
import 'constants.dart';
import 'logical_key_data.dart';
import 'physical_key_data.dart';
import 'utils.dart';
const List<String> kModifiersOfInterest = <String>[
'ShiftLeft',
'ShiftRight',
'ControlLeft',
'ControlRight',
'AltLeft',
'AltRight',
'MetaLeft',
'MetaRight',
];
// The name of keys that require special attention.
const List<String> kSpecialPhysicalKeys = <String>['CapsLock'];
const List<String> kSpecialLogicalKeys = <String>['CapsLock'];
/// Generates the key mapping for macOS, based on the information in the key
/// data structure given to it.
class MacOSCodeGenerator extends PlatformCodeGenerator {
MacOSCodeGenerator(super.keyData, super.logicalData, this._layoutGoals);
/// This generates the map of macOS key codes to physical keys.
String get _scanCodeMap {
final OutputLines<int> lines = OutputLines<int>('macOS scancode map');
for (final PhysicalKeyEntry entry in keyData.entries) {
if (entry.macOSScanCode != null) {
lines.add(entry.macOSScanCode!, ' @${toHex(entry.macOSScanCode)} : @${toHex(entry.usbHidCode)}, // ${entry.constantName}');
}
}
return lines.sortedJoin().trimRight();
}
String get _keyCodeToLogicalMap {
final OutputLines<int> lines = OutputLines<int>('macOS keycode map');
for (final LogicalKeyEntry entry in logicalData.entries) {
zipStrict(entry.macOSKeyCodeValues, entry.macOSKeyCodeNames, (int macOSValue, String macOSName) {
lines.add(macOSValue,
' @${toHex(macOSValue)} : @${toHex(entry.value, digits: 11)}, // $macOSName -> ${entry.constantName}');
});
}
return lines.sortedJoin().trimRight();
}
/// This generates the mask values for the part of a key code that defines its plane.
String get _maskConstants {
final StringBuffer buffer = StringBuffer();
const List<MaskConstant> maskConstants = <MaskConstant>[
kValueMask,
kUnicodePlane,
kMacosPlane,
];
for (final MaskConstant constant in maskConstants) {
buffer.writeln('const uint64_t k${constant.upperCamelName} = ${toHex(constant.value, digits: 11)};');
}
return buffer.toString().trimRight();
}
/// This generates a map from the key code to a modifier flag.
String get _keyToModifierFlagMap {
final StringBuffer modifierKeyMap = StringBuffer();
for (final String name in kModifiersOfInterest) {
modifierKeyMap.writeln(' @${toHex(logicalData.entryByName(name).macOSKeyCodeValues[0])} : @(kModifierFlag${lowerCamelToUpperCamel(name)}),');
}
return modifierKeyMap.toString().trimRight();
}
/// This generates a map from the modifier flag to the key code.
String get _modifierFlagToKeyMap {
final StringBuffer modifierKeyMap = StringBuffer();
for (final String name in kModifiersOfInterest) {
modifierKeyMap.writeln(' @(kModifierFlag${lowerCamelToUpperCamel(name)}) : @${toHex(logicalData.entryByName(name).macOSKeyCodeValues[0])},');
}
return modifierKeyMap.toString().trimRight();
}
/// This generates some keys that needs special attention.
String get _specialKeyConstants {
final StringBuffer specialKeyConstants = StringBuffer();
for (final String keyName in kSpecialPhysicalKeys) {
specialKeyConstants.writeln('const uint64_t k${keyName}PhysicalKey = ${toHex(keyData.entryByName(keyName).usbHidCode)};');
}
for (final String keyName in kSpecialLogicalKeys) {
specialKeyConstants.writeln('const uint64_t k${lowerCamelToUpperCamel(keyName)}LogicalKey = ${toHex(logicalData.entryByName(keyName).value)};');
}
return specialKeyConstants.toString().trimRight();
}
final Map<String, bool> _layoutGoals;
String get _layoutGoalsString {
final OutputLines<int> lines = OutputLines<int>('macOS layout goals');
_layoutGoals.forEach((String name, bool mandatory) {
final PhysicalKeyEntry physicalEntry = keyData.entryByName(name);
final LogicalKeyEntry logicalEntry = logicalData.entryByName(name);
final String line = 'LayoutGoal{'
'${toHex(physicalEntry.macOSScanCode, digits: 2)}, '
'${toHex(logicalEntry.value, digits: 2)}, '
'${mandatory ? 'true' : 'false'}'
'},';
lines.add(logicalEntry.value,
' ${line.padRight(32)}'
'// ${logicalEntry.name}');
});
return lines.sortedJoin().trimRight();
}
@override
String get templatePath => path.join(dataRoot, 'macos_key_code_map_cc.tmpl');
@override
String outputPath(String platform) => path.join(PlatformCodeGenerator.engineRoot,
'shell', 'platform', 'darwin', 'macos', 'framework', 'Source', 'KeyCodeMap.g.mm');
@override
Map<String, String> mappings() {
// There is no macOS keycode map since macOS uses keycode to represent a physical key.
// The LogicalKeyboardKey is generated by raw_keyboard_macos.dart from the unmodified characters
// from NSEvent.
return <String, String>{
'MACOS_SCAN_CODE_MAP': _scanCodeMap,
'MACOS_KEYCODE_LOGICAL_MAP': _keyCodeToLogicalMap,
'MASK_CONSTANTS': _maskConstants,
'KEYCODE_TO_MODIFIER_FLAG_MAP': _keyToModifierFlagMap,
'MODIFIER_FLAG_TO_KEYCODE_MAP': _modifierFlagToKeyMap,
'SPECIAL_KEY_CONSTANTS': _specialKeyConstants,
'LAYOUT_GOALS': _layoutGoalsString,
};
}
}
| flutter/dev/tools/gen_keycodes/lib/macos_code_gen.dart/0 | {
"file_path": "flutter/dev/tools/gen_keycodes/lib/macos_code_gen.dart",
"repo_id": "flutter",
"token_count": 2018
} | 726 |
// 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 'localizations_utils.dart';
// See http://en.wikipedia.org/wiki/Right-to-left
const List<String> _rtlLanguages = <String>[
'ar', // Arabic
'fa', // Farsi
'he', // Hebrew
'ps', // Pashto
'ur', // Urdu
];
String generateWidgetsHeader(String regenerateInstructions) {
return '''
// 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.
// This file has been automatically generated. Please do not edit it manually.
// To regenerate the file, use:
// $regenerateInstructions
import 'dart:collection';
import 'dart:ui';
import '../widgets_localizations.dart';
// The classes defined here encode all of the translations found in the
// `flutter_localizations/lib/src/l10n/*.arb` files.
//
// These classes are constructed by the [getWidgetsTranslation] method at the
// bottom of this file, and used by the [_WidgetsLocalizationsDelegate.load]
// method defined in `flutter_localizations/lib/src/widgets_localizations.dart`.''';
}
/// Returns the source of the constructor for a GlobalWidgetsLocalizations
/// subclass.
String generateWidgetsConstructor(LocaleInfo locale) {
final String localeName = locale.originalString;
final String language = locale.languageCode.toLowerCase();
final String textDirection = _rtlLanguages.contains(language) ? 'TextDirection.rtl' : 'TextDirection.ltr';
return '''
/// Create an instance of the translation bundle for ${describeLocale(localeName)}.
///
/// For details on the meaning of the arguments, see [GlobalWidgetsLocalizations].
const WidgetsLocalization${locale.camelCase()}() : super($textDirection);''';
}
/// Returns the source of the constructor for a GlobalWidgetsLocalizations
/// subclass.
String generateWidgetsConstructorForCountrySubclass(LocaleInfo locale) {
final String localeName = locale.originalString;
return '''
/// Create an instance of the translation bundle for ${describeLocale(localeName)}.
///
/// For details on the meaning of the arguments, see [GlobalWidgetsLocalizations].
const WidgetsLocalization${locale.camelCase()}();''';
}
const String widgetsFactoryName = 'getWidgetsTranslation';
const String widgetsFactoryDeclaration = '''
GlobalWidgetsLocalizations? getWidgetsTranslation(
Locale locale,
) {''';
const String widgetsFactoryArguments = '';
const String widgetsSupportedLanguagesConstant = 'kWidgetsSupportedLanguages';
const String widgetsSupportedLanguagesDocMacro = 'flutter.localizations.widgets.languages';
| flutter/dev/tools/localization/gen_widgets_localizations.dart/0 | {
"file_path": "flutter/dev/tools/localization/gen_widgets_localizations.dart",
"repo_id": "flutter",
"token_count": 774
} | 727 |
<svg id="svg_build_00" xmlns="http://www.w3.org/2000/svg" width="48px" height="48px" >
<g if="group_2" opacity="0.5" >
<path id="path_1" d="M 0,19.0 L 48.0, 19.0 L 48.0, 29.0 L 0, 29.0 Z " fill="#000000" />
</g>
</svg>
| flutter/dev/tools/vitool/test_assets/bar_group_opacity.svg/0 | {
"file_path": "flutter/dev/tools/vitool/test_assets/bar_group_opacity.svg",
"repo_id": "flutter",
"token_count": 117
} | 728 |
# This file is also used by dev/bots/analyze_snippet_code.dart to analyze code snippets (`{@tool snippet}` sections).
include: ../../analysis_options.yaml
linter:
rules:
# Samples want to print things pretty often.
avoid_print: false
# Samples are sometimes incomplete and don't show usage of everything.
unreachable_from_main: false
| flutter/examples/api/analysis_options.yaml/0 | {
"file_path": "flutter/examples/api/analysis_options.yaml",
"repo_id": "flutter",
"token_count": 112
} | 729 |
// 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 [CupertinoTimerPicker].
void main() => runApp(const TimerPickerApp());
class TimerPickerApp extends StatelessWidget {
const TimerPickerApp({super.key});
@override
Widget build(BuildContext context) {
return const CupertinoApp(
theme: CupertinoThemeData(brightness: Brightness.light),
home: TimerPickerExample(),
);
}
}
class TimerPickerExample extends StatefulWidget {
const TimerPickerExample({super.key});
@override
State<TimerPickerExample> createState() => _TimerPickerExampleState();
}
class _TimerPickerExampleState extends State<TimerPickerExample> {
Duration duration = const Duration(hours: 1, minutes: 23);
// This shows a CupertinoModalPopup with a reasonable fixed height which hosts
// a CupertinoTimerPicker.
void _showDialog(Widget child) {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) => Container(
height: 216,
padding: const EdgeInsets.only(top: 6.0),
// The bottom margin is provided to align the popup above the system
// navigation bar.
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom,
),
// Provide a background color for the popup.
color: CupertinoColors.systemBackground.resolveFrom(context),
// Use a SafeArea widget to avoid system overlaps.
child: SafeArea(
top: false,
child: child,
),
),
);
}
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('CupertinoTimerPicker Sample'),
),
child: DefaultTextStyle(
style: TextStyle(
color: CupertinoColors.label.resolveFrom(context),
fontSize: 22.0,
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_TimerPickerItem(
children: <Widget>[
const Text('Timer'),
CupertinoButton(
// Display a CupertinoTimerPicker with hour/minute mode.
onPressed: () => _showDialog(
CupertinoTimerPicker(
mode: CupertinoTimerPickerMode.hm,
initialTimerDuration: duration,
// This is called when the user changes the timer's
// duration.
onTimerDurationChanged: (Duration newDuration) {
setState(() => duration = newDuration);
},
),
),
// In this example, the timer's value is formatted manually.
// You can use the intl package to format the value based on
// the user's locale settings.
child: Text(
'$duration',
style: const TextStyle(
fontSize: 22.0,
),
),
),
],
),
],
),
),
),
);
}
}
// This class simply decorates a row of widgets.
class _TimerPickerItem extends StatelessWidget {
const _TimerPickerItem({required this.children});
final List<Widget> children;
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: const BoxDecoration(
border: Border(
top: BorderSide(
color: CupertinoColors.inactiveGray,
width: 0.0,
),
bottom: BorderSide(
color: CupertinoColors.inactiveGray,
width: 0.0,
),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: children,
),
),
);
}
}
| flutter/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart/0 | {
"file_path": "flutter/examples/api/lib/cupertino/date_picker/cupertino_timer_picker.0.dart",
"repo_id": "flutter",
"token_count": 1984
} | 730 |
// 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 [CupertinoScrollbar].
void main() => runApp(const ScrollbarApp());
class ScrollbarApp extends StatelessWidget {
const ScrollbarApp({super.key});
@override
Widget build(BuildContext context) {
return const CupertinoApp(
theme: CupertinoThemeData(brightness: Brightness.light),
home: ScrollbarExample(),
);
}
}
class ScrollbarExample extends StatefulWidget {
const ScrollbarExample({super.key});
@override
State<ScrollbarExample> createState() => _ScrollbarExampleState();
}
class _ScrollbarExampleState extends State<ScrollbarExample> {
final ScrollController _controllerOne = ScrollController();
@override
Widget build(BuildContext context) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('CupertinoScrollbar Sample'),
),
child: CupertinoScrollbar(
thickness: 6.0,
thicknessWhileDragging: 10.0,
radius: const Radius.circular(34.0),
radiusWhileDragging: Radius.zero,
controller: _controllerOne,
thumbVisibility: true,
child: ListView.builder(
controller: _controllerOne,
itemCount: 120,
itemBuilder: (BuildContext context, int index) {
return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text('Item $index'),
),
);
},
),
),
);
}
}
| flutter/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart/0 | {
"file_path": "flutter/examples/api/lib/cupertino/scrollbar/cupertino_scrollbar.1.dart",
"repo_id": "flutter",
"token_count": 656
} | 731 |
// 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/material.dart';
/// Flutter code sample for [AnimatedIcon].
void main() {
runApp(const AnimatedIconApp());
}
class AnimatedIconApp extends StatelessWidget {
const AnimatedIconApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
colorSchemeSeed: const Color(0xff6750a4),
useMaterial3: true,
),
home: const Scaffold(
body: AnimatedIconExample(),
),
);
}
}
class AnimatedIconExample extends StatefulWidget {
const AnimatedIconExample({super.key});
@override
State<AnimatedIconExample> createState() => _AnimatedIconExampleState();
}
class _AnimatedIconExampleState extends State<AnimatedIconExample> with SingleTickerProviderStateMixin {
late AnimationController controller;
late Animation<double> animation;
@override
void initState() {
super.initState();
controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 2),
)
..forward()
..repeat(reverse: true);
animation = Tween<double>(begin: 0.0, end: 1.0).animate(controller);
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: AnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: animation,
size: 72.0,
semanticLabel: 'Show menu',
),
),
);
}
}
| flutter/examples/api/lib/material/animated_icon/animated_icon.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/animated_icon/animated_icon.0.dart",
"repo_id": "flutter",
"token_count": 609
} | 732 |
// 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/material.dart';
/// Flutter code sample for [MaterialBanner].
void main() => runApp(const MaterialBannerExampleApp());
class MaterialBannerExampleApp extends StatelessWidget {
const MaterialBannerExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: MaterialBannerExample(),
);
}
}
class MaterialBannerExample extends StatelessWidget {
const MaterialBannerExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('The MaterialBanner is below'),
),
body: const MaterialBanner(
padding: EdgeInsets.all(20),
content: Text('Hello, I am a Material Banner'),
leading: Icon(Icons.agriculture_outlined),
backgroundColor: Color(0xFFE0E0E0),
actions: <Widget>[
TextButton(
onPressed: null,
child: Text('OPEN'),
),
TextButton(
onPressed: null,
child: Text('DISMISS'),
),
],
),
);
}
}
| flutter/examples/api/lib/material/banner/material_banner.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/banner/material_banner.0.dart",
"repo_id": "flutter",
"token_count": 504
} | 733 |
// 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/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
/// Flutter code sample for [CheckboxListTile].
void main() => runApp(const CheckboxListTileApp());
class CheckboxListTileApp extends StatelessWidget {
const CheckboxListTileApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const CheckboxListTileExample(),
);
}
}
class CheckboxListTileExample extends StatefulWidget {
const CheckboxListTileExample({super.key});
@override
State<CheckboxListTileExample> createState() => _CheckboxListTileExampleState();
}
class _CheckboxListTileExampleState extends State<CheckboxListTileExample> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('CheckboxListTile Sample')),
body: Center(
child: CheckboxListTile(
title: const Text('Animate Slowly'),
value: timeDilation != 1.0,
onChanged: (bool? value) {
setState(() {
timeDilation = value! ? 10.0 : 1.0;
});
},
secondary: const Icon(Icons.hourglass_empty),
),
),
);
}
}
| flutter/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/checkbox_list_tile/checkbox_list_tile.0.dart",
"repo_id": "flutter",
"token_count": 523
} | 734 |
// 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/material.dart';
/// Flutter code sample for [DataTable].
void main() => runApp(const DataTableExampleApp());
class DataTableExampleApp extends StatelessWidget {
const DataTableExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('DataTable Sample')),
body: const DataTableExample(),
),
);
}
}
class DataTableExample extends StatefulWidget {
const DataTableExample({super.key});
@override
State<DataTableExample> createState() => _DataTableExampleState();
}
class _DataTableExampleState extends State<DataTableExample> {
static const int numItems = 20;
List<bool> selected = List<bool>.generate(numItems, (int index) => false);
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: DataTable(
columns: const <DataColumn>[
DataColumn(
label: Text('Number'),
),
],
rows: List<DataRow>.generate(
numItems,
(int index) => DataRow(
color: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
// All rows will have the same selected color.
if (states.contains(MaterialState.selected)) {
return Theme.of(context).colorScheme.primary.withOpacity(0.08);
}
// Even rows will have a grey color.
if (index.isEven) {
return Colors.grey.withOpacity(0.3);
}
return null; // Use default value for other states and odd rows.
}),
cells: <DataCell>[DataCell(Text('Row $index'))],
selected: selected[index],
onSelectChanged: (bool? value) {
setState(() {
selected[index] = value!;
});
},
),
),
),
);
}
}
| flutter/examples/api/lib/material/data_table/data_table.1.dart/0 | {
"file_path": "flutter/examples/api/lib/material/data_table/data_table.1.dart",
"repo_id": "flutter",
"token_count": 893
} | 735 |
// 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/material.dart';
/// Flutter code sample for [DropdownButton].
const List<String> list = <String>['One', 'Two', 'Three', 'Four'];
void main() => runApp(const DropdownButtonApp());
class DropdownButtonApp extends StatelessWidget {
const DropdownButtonApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('DropdownButton Sample')),
body: const Center(
child: DropdownButtonExample(),
),
),
);
}
}
class DropdownButtonExample extends StatefulWidget {
const DropdownButtonExample({super.key});
@override
State<DropdownButtonExample> createState() => _DropdownButtonExampleState();
}
class _DropdownButtonExampleState extends State<DropdownButtonExample> {
String dropdownValue = list.first;
@override
Widget build(BuildContext context) {
return DropdownButton<String>(
value: dropdownValue,
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
underline: Container(
height: 2,
color: Colors.deepPurpleAccent,
),
onChanged: (String? value) {
// This is called when the user selects an item.
setState(() {
dropdownValue = value!;
});
},
items: list.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
);
}
}
| flutter/examples/api/lib/material/dropdown/dropdown_button.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/dropdown/dropdown_button.0.dart",
"repo_id": "flutter",
"token_count": 645
} | 736 |
// 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/material.dart';
/// Flutter code sample for [FloatingActionButton].
void main() => runApp(const FloatingActionButtonExampleApp());
class FloatingActionButtonExampleApp extends StatelessWidget {
const FloatingActionButtonExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const FloatingActionButtonExample(),
);
}
}
class FloatingActionButtonExample extends StatelessWidget {
const FloatingActionButtonExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('FloatingActionButton Sample'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Small'),
const SizedBox(width: 16),
// An example of the small floating action button.
//
// https://m3.material.io/components/floating-action-button/specs#669a1be8-7271-48cb-a74d-dd502d73bda4
FloatingActionButton.small(
onPressed: () {
// Add your onPressed code here!
},
child: const Icon(Icons.add),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Regular'),
const SizedBox(width: 16),
// An example of the regular floating action button.
//
// https://m3.material.io/components/floating-action-button/specs#71504201-7bd1-423d-8bb7-07e0291743e5
FloatingActionButton(
onPressed: () {
// Add your onPressed code here!
},
child: const Icon(Icons.add),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Large'),
const SizedBox(width: 16),
// An example of the large floating action button.
//
// https://m3.material.io/components/floating-action-button/specs#9d7d3d6a-bab7-47cb-be32-5596fbd660fe
FloatingActionButton.large(
onPressed: () {
// Add your onPressed code here!
},
child: const Icon(Icons.add),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Extended'),
const SizedBox(width: 16),
// An example of the extended floating action button.
//
// https://m3.material.io/components/extended-fab/specs#686cb8af-87c9-48e8-a3e1-db9da6f6c69b
FloatingActionButton.extended(
onPressed: () {
// Add your onPressed code here!
},
label: const Text('Add'),
icon: const Icon(Icons.add),
),
],
),
],
),
),
);
}
}
| flutter/examples/api/lib/material/floating_action_button/floating_action_button.1.dart/0 | {
"file_path": "flutter/examples/api/lib/material/floating_action_button/floating_action_button.1.dart",
"repo_id": "flutter",
"token_count": 1906
} | 737 |
// 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/material.dart';
/// Flutter code sample for [InputDecorator].
void main() => runApp(const FloatingLabelStyleErrorExampleApp());
class FloatingLabelStyleErrorExampleApp extends StatelessWidget {
const FloatingLabelStyleErrorExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: Scaffold(
appBar: AppBar(title: const Text('InputDecorator Sample')),
body: const Center(
child: InputDecoratorExample(),
),
),
);
}
}
class InputDecoratorExample extends StatelessWidget {
const InputDecoratorExample({super.key});
@override
Widget build(BuildContext context) {
return TextFormField(
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: 'Name',
// The MaterialStateProperty's value is a text style that is orange
// by default, but the theme's error color if the input decorator
// is in its error state.
floatingLabelStyle: MaterialStateTextStyle.resolveWith(
(Set<MaterialState> states) {
final Color color =
states.contains(MaterialState.error) ? Theme.of(context).colorScheme.error : Colors.orange;
return TextStyle(color: color, letterSpacing: 1.3);
},
),
),
validator: (String? value) {
if (value == null || value == '') {
return 'Enter name';
}
return null;
},
autovalidateMode: AutovalidateMode.always,
);
}
}
| flutter/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/input_decorator/input_decoration.floating_label_style_error.0.dart",
"repo_id": "flutter",
"token_count": 661
} | 738 |
// 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/material.dart';
/// Flutter code sample for [ListTile].
void main() => runApp(const ListTileApp());
class ListTileApp extends StatelessWidget {
const ListTileApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const ListTileExample(),
);
}
}
class ListTileExample extends StatefulWidget {
const ListTileExample({super.key});
@override
State<ListTileExample> createState() => _ListTileExampleState();
}
class _ListTileExampleState extends State<ListTileExample> {
ListTileTitleAlignment? titleAlignment;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('ListTile.titleAlignment Sample')),
body: Column(
children: <Widget>[
const Divider(),
ListTile(
titleAlignment: titleAlignment,
leading: Checkbox(
value: true,
onChanged: (bool? value) {},
),
title: const Text('Headline Text'),
subtitle: const Text(
'Tapping on the trailing widget will show a menu that allows you to change the title alignment. The title alignment is set to threeLine by default if `ThemeData.useMaterial3` is true. Otherwise, defaults to titleHeight.'),
trailing: PopupMenuButton<ListTileTitleAlignment>(
onSelected: (ListTileTitleAlignment? value) {
setState(() {
titleAlignment = value;
});
},
itemBuilder: (BuildContext context) => <PopupMenuEntry<ListTileTitleAlignment>>[
const PopupMenuItem<ListTileTitleAlignment>(
value: ListTileTitleAlignment.threeLine,
child: Text('threeLine'),
),
const PopupMenuItem<ListTileTitleAlignment>(
value: ListTileTitleAlignment.titleHeight,
child: Text('titleHeight'),
),
const PopupMenuItem<ListTileTitleAlignment>(
value: ListTileTitleAlignment.top,
child: Text('top'),
),
const PopupMenuItem<ListTileTitleAlignment>(
value: ListTileTitleAlignment.center,
child: Text('center'),
),
const PopupMenuItem<ListTileTitleAlignment>(
value: ListTileTitleAlignment.bottom,
child: Text('bottom'),
),
],
),
),
const Divider(),
],
),
);
}
}
| flutter/examples/api/lib/material/list_tile/list_tile.4.dart/0 | {
"file_path": "flutter/examples/api/lib/material/list_tile/list_tile.4.dart",
"repo_id": "flutter",
"token_count": 1273
} | 739 |
// 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.
// Builds an adaptive navigation widget layout. When the screen width is less than
// 450, A [NavigationBar] will be displayed. Otherwise, a [NavigationRail] will be
// displayed on the left side, and also a button to open the [NavigationDrawer].
// All of these navigation widgets are built from an identical list of data.
import 'package:flutter/material.dart';
/// Flutter code sample for [NavigationDrawer].
void main() => runApp(const NavigationDrawerApp());
class ExampleDestination {
const ExampleDestination(this.label, this.icon, this.selectedIcon);
final String label;
final Widget icon;
final Widget selectedIcon;
}
const List<ExampleDestination> destinations = <ExampleDestination>[
ExampleDestination('Messages', Icon(Icons.widgets_outlined), Icon(Icons.widgets)),
ExampleDestination('Profile', Icon(Icons.format_paint_outlined), Icon(Icons.format_paint)),
ExampleDestination('Settings', Icon(Icons.settings_outlined), Icon(Icons.settings)),
];
class NavigationDrawerApp extends StatelessWidget {
const NavigationDrawerApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(useMaterial3: true),
home: const NavigationDrawerExample(),
);
}
}
class NavigationDrawerExample extends StatefulWidget {
const NavigationDrawerExample({super.key});
@override
State<NavigationDrawerExample> createState() => _NavigationDrawerExampleState();
}
class _NavigationDrawerExampleState extends State<NavigationDrawerExample> {
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
int screenIndex = 0;
late bool showNavigationDrawer;
void handleScreenChanged(int selectedScreen) {
setState(() {
screenIndex = selectedScreen;
});
}
void openDrawer() {
scaffoldKey.currentState!.openEndDrawer();
}
Widget buildBottomBarScaffold() {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text('Page Index = $screenIndex'),
],
),
),
bottomNavigationBar: NavigationBar(
selectedIndex: screenIndex,
onDestinationSelected: (int index) {
setState(() {
screenIndex = index;
});
},
destinations: destinations.map(
(ExampleDestination destination) {
return NavigationDestination(
label: destination.label,
icon: destination.icon,
selectedIcon: destination.selectedIcon,
tooltip: destination.label,
);
},
).toList(),
),
);
}
Widget buildDrawerScaffold(BuildContext context) {
return Scaffold(
key: scaffoldKey,
body: SafeArea(
bottom: false,
top: false,
child: Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
child: NavigationRail(
minWidth: 50,
destinations: destinations.map(
(ExampleDestination destination) {
return NavigationRailDestination(
label: Text(destination.label),
icon: destination.icon,
selectedIcon: destination.selectedIcon,
);
},
).toList(),
selectedIndex: screenIndex,
useIndicator: true,
onDestinationSelected: (int index) {
setState(() {
screenIndex = index;
});
},
),
),
const VerticalDivider(thickness: 1, width: 1),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text('Page Index = $screenIndex'),
ElevatedButton(
onPressed: openDrawer,
child: const Text('Open Drawer'),
),
],
),
),
],
),
),
endDrawer: NavigationDrawer(
onDestinationSelected: handleScreenChanged,
selectedIndex: screenIndex,
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(28, 16, 16, 10),
child: Text(
'Header',
style: Theme.of(context).textTheme.titleSmall,
),
),
...destinations.map(
(ExampleDestination destination) {
return NavigationDrawerDestination(
label: Text(destination.label),
icon: destination.icon,
selectedIcon: destination.selectedIcon,
);
},
),
const Padding(
padding: EdgeInsets.fromLTRB(28, 16, 28, 10),
child: Divider(),
),
],
),
);
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
showNavigationDrawer = MediaQuery.of(context).size.width >= 450;
}
@override
Widget build(BuildContext context) {
return showNavigationDrawer ? buildDrawerScaffold(context) : buildBottomBarScaffold();
}
}
| flutter/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/navigation_drawer/navigation_drawer.0.dart",
"repo_id": "flutter",
"token_count": 2468
} | 740 |
// 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/material.dart';
/// Flutter code sample for [LinearProgressIndicator].
void main() => runApp(const ProgressIndicatorApp());
class ProgressIndicatorApp extends StatelessWidget {
const ProgressIndicatorApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true, colorSchemeSeed: const Color(0xff6750a4)),
home: const ProgressIndicatorExample(),
);
}
}
class ProgressIndicatorExample extends StatefulWidget {
const ProgressIndicatorExample({super.key});
@override
State<ProgressIndicatorExample> createState() => _ProgressIndicatorExampleState();
}
class _ProgressIndicatorExampleState extends State<ProgressIndicatorExample> with TickerProviderStateMixin {
late AnimationController controller;
bool determinate = false;
@override
void initState() {
controller = AnimationController(
/// [AnimationController]s can be created with `vsync: this` because of
/// [TickerProviderStateMixin].
vsync: this,
duration: const Duration(seconds: 2),
)..addListener(() {
setState(() {});
});
controller.repeat();
super.initState();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Linear progress indicator',
style: TextStyle(fontSize: 20),
),
const SizedBox(height: 30),
LinearProgressIndicator(
value: controller.value,
semanticsLabel: 'Linear progress indicator',
),
const SizedBox(height: 10),
Row(
children: <Widget>[
Expanded(
child: Text(
'determinate Mode',
style: Theme.of(context).textTheme.titleSmall,
),
),
Switch(
value: determinate,
onChanged: (bool value) {
setState(() {
determinate = value;
if (determinate) {
controller.stop();
} else {
controller
..forward(from: controller.value)
..repeat();
}
});
},
),
],
),
],
),
),
);
}
}
| flutter/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart/0 | {
"file_path": "flutter/examples/api/lib/material/progress_indicator/linear_progress_indicator.1.dart",
"repo_id": "flutter",
"token_count": 1351
} | 741 |
// 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/material.dart';
/// Flutter code sample for [Scaffold].
void main() => runApp(const ScaffoldExampleApp());
class ScaffoldExampleApp extends StatelessWidget {
const ScaffoldExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: ScaffoldExample(),
);
}
}
class ScaffoldExample extends StatefulWidget {
const ScaffoldExample({super.key});
@override
State<ScaffoldExample> createState() => _ScaffoldExampleState();
}
class _ScaffoldExampleState extends State<ScaffoldExample> {
int _count = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Sample Code'),
),
body: Center(child: Text('You have pressed the button $_count times.')),
floatingActionButton: FloatingActionButton(
onPressed: () => setState(() => _count++),
tooltip: 'Increment Counter',
child: const Icon(Icons.add),
),
);
}
}
| flutter/examples/api/lib/material/scaffold/scaffold.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/scaffold/scaffold.0.dart",
"repo_id": "flutter",
"token_count": 406
} | 742 |
// 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/material.dart';
/// Flutter code sample for [Scrollbar].
void main() => runApp(const ScrollbarExampleApp());
class ScrollbarExampleApp extends StatelessWidget {
const ScrollbarExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Scrollbar Sample')),
body: const ScrollbarExample(),
),
);
}
}
class ScrollbarExample extends StatefulWidget {
const ScrollbarExample({super.key});
@override
State<ScrollbarExample> createState() => _ScrollbarExampleState();
}
class _ScrollbarExampleState extends State<ScrollbarExample> {
final ScrollController _controllerOne = ScrollController();
@override
Widget build(BuildContext context) {
return Scrollbar(
controller: _controllerOne,
thumbVisibility: true,
child: GridView.builder(
controller: _controllerOne,
itemCount: 120,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (BuildContext context, int index) {
return Center(
child: Text('item $index'),
);
},
),
);
}
}
| flutter/examples/api/lib/material/scrollbar/scrollbar.1.dart/0 | {
"file_path": "flutter/examples/api/lib/material/scrollbar/scrollbar.1.dart",
"repo_id": "flutter",
"token_count": 483
} | 743 |
// 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/material.dart';
/// Flutter code sample for [SnackBar].
void main() => runApp(const SnackBarExampleApp());
class SnackBarExampleApp extends StatelessWidget {
const SnackBarExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('SnackBar Sample')),
body: const Center(
child: SnackBarExample(),
),
),
);
}
}
class SnackBarExample extends StatelessWidget {
const SnackBarExample({super.key});
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: const Text('Show Snackbar'),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('Awesome Snackbar!'),
action: SnackBarAction(
label: 'Action',
onPressed: () {
// Code to execute.
},
),
),
);
},
);
}
}
| flutter/examples/api/lib/material/snack_bar/snack_bar.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/snack_bar/snack_bar.0.dart",
"repo_id": "flutter",
"token_count": 508
} | 744 |
// 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/material.dart';
/// Flutter code sample for [TabBar].
void main() => runApp(const TabBarApp());
class TabBarApp extends StatelessWidget {
const TabBarApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(useMaterial3: true),
home: const TabBarExample(),
);
}
}
class TabBarExample extends StatelessWidget {
const TabBarExample({super.key});
@override
Widget build(BuildContext context) {
return DefaultTabController(
initialIndex: 1,
length: 3,
child: Scaffold(
appBar: AppBar(
title: const Text('TabBar Sample'),
bottom: const TabBar(
tabs: <Widget>[
Tab(
icon: Icon(Icons.cloud_outlined),
),
Tab(
icon: Icon(Icons.beach_access_sharp),
),
Tab(
icon: Icon(Icons.brightness_5_sharp),
),
],
),
),
body: const TabBarView(
children: <Widget>[
Center(
child: Text("It's cloudy here"),
),
Center(
child: Text("It's rainy here"),
),
Center(
child: Text("It's sunny here"),
),
],
),
),
);
}
}
| flutter/examples/api/lib/material/tabs/tab_bar.0.dart/0 | {
"file_path": "flutter/examples/api/lib/material/tabs/tab_bar.0.dart",
"repo_id": "flutter",
"token_count": 744
} | 745 |
// 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/material.dart';
/// Flutter code sample for [Tooltip].
void main() => runApp(const TooltipExampleApp());
class TooltipExampleApp extends StatelessWidget {
const TooltipExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(tooltipTheme: const TooltipThemeData(preferBelow: false)),
home: Scaffold(
appBar: AppBar(title: const Text('Tooltip Sample')),
body: const Center(
child: TooltipSample(),
),
),
);
}
}
class TooltipSample extends StatelessWidget {
const TooltipSample({super.key});
@override
Widget build(BuildContext context) {
return const Tooltip(
richMessage: TextSpan(
text: 'I am a rich tooltip. ',
style: TextStyle(color: Colors.red),
children: <InlineSpan>[
TextSpan(
text: 'I am another span of this rich tooltip',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
child: Text('Tap this text and hold down to show a tooltip.'),
);
}
}
| flutter/examples/api/lib/material/tooltip/tooltip.2.dart/0 | {
"file_path": "flutter/examples/api/lib/material/tooltip/tooltip.2.dart",
"repo_id": "flutter",
"token_count": 483
} | 746 |
// 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 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// Flutter code sample for [ServicesBinding.handleRequestAppExit].
void main() {
runApp(const ApplicationExitExample());
}
class ApplicationExitExample extends StatelessWidget {
const ApplicationExitExample({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(body: Body()),
);
}
}
class Body extends StatefulWidget {
const Body({super.key});
@override
State<Body> createState() => _BodyState();
}
class _BodyState extends State<Body> with WidgetsBindingObserver {
bool _shouldExit = false;
String lastResponse = 'No exit requested yet';
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
Future<void> _quit() async {
final AppExitType exitType = _shouldExit ? AppExitType.required : AppExitType.cancelable;
setState(() {
lastResponse = 'App requesting ${exitType.name} exit';
});
await ServicesBinding.instance.exitApplication(exitType);
}
@override
Future<AppExitResponse> didRequestAppExit() async {
final AppExitResponse response = _shouldExit ? AppExitResponse.exit : AppExitResponse.cancel;
setState(() {
lastResponse = 'App responded ${response.name} to exit request';
});
return response;
}
void _radioChanged(bool? value) {
value ??= true;
if (_shouldExit == value) {
return;
}
setState(() {
_shouldExit = value!;
});
}
@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
width: 300,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
RadioListTile<bool>(
title: const Text('Do Not Allow Exit'),
groupValue: _shouldExit,
value: false,
onChanged: _radioChanged,
),
RadioListTile<bool>(
title: const Text('Allow Exit'),
groupValue: _shouldExit,
value: true,
onChanged: _radioChanged,
),
const SizedBox(height: 30),
ElevatedButton(
onPressed: _quit,
child: const Text('Quit'),
),
const SizedBox(height: 30),
Text(lastResponse),
],
),
),
);
}
}
| flutter/examples/api/lib/services/binding/handle_request_app_exit.0.dart/0 | {
"file_path": "flutter/examples/api/lib/services/binding/handle_request_app_exit.0.dart",
"repo_id": "flutter",
"token_count": 1101
} | 747 |
// 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/widgets.dart';
/// Flutter code sample for [FontFeature.FontFeature.historicalLigatures].
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
@override
Widget build(BuildContext context) {
return WidgetsApp(
builder: (BuildContext context, Widget? navigator) => const ExampleWidget(),
color: const Color(0xffffffff),
);
}
}
class ExampleWidget extends StatelessWidget {
const ExampleWidget({super.key});
@override
Widget build(BuildContext context) {
// The Cardo font can be downloaded from Google Fonts
// (https://www.google.com/fonts).
return const Text(
'VIBRANT fish assisted his business.',
style: TextStyle(
fontFamily: 'Sorts Mill Goudy',
fontFeatures: <FontFeature>[
FontFeature.historicalForms(), // Enables "hist".
FontFeature.historicalLigatures(), // Enables "hlig".
],
),
);
}
}
| flutter/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart/0 | {
"file_path": "flutter/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart",
"repo_id": "flutter",
"token_count": 399
} | 748 |
// 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/material.dart';
/// Flutter code sample for [RawAutocomplete].
void main() => runApp(const AutocompleteExampleApp());
class AutocompleteExampleApp extends StatelessWidget {
const AutocompleteExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RawAutocomplete Basic'),
),
body: const Center(
child: AutocompleteBasicExample(),
),
),
);
}
}
class AutocompleteBasicExample extends StatelessWidget {
const AutocompleteBasicExample({super.key});
static const List<String> _options = <String>[
'aardvark',
'bobcat',
'chameleon',
];
@override
Widget build(BuildContext context) {
return RawAutocomplete<String>(
optionsBuilder: (TextEditingValue textEditingValue) {
return _options.where((String option) {
return option.contains(textEditingValue.text.toLowerCase());
});
},
fieldViewBuilder: (
BuildContext context,
TextEditingController textEditingController,
FocusNode focusNode,
VoidCallback onFieldSubmitted,
) {
return TextFormField(
controller: textEditingController,
focusNode: focusNode,
onFieldSubmitted: (String value) {
onFieldSubmitted();
},
);
},
optionsViewBuilder: (
BuildContext context,
AutocompleteOnSelected<String> onSelected,
Iterable<String> options,
) {
return Align(
alignment: Alignment.topLeft,
child: Material(
elevation: 4.0,
child: SizedBox(
height: 200.0,
child: ListView.builder(
padding: const EdgeInsets.all(8.0),
itemCount: options.length,
itemBuilder: (BuildContext context, int index) {
final String option = options.elementAt(index);
return GestureDetector(
onTap: () {
onSelected(option);
},
child: ListTile(
title: Text(option),
),
);
},
),
),
),
);
},
);
}
}
| flutter/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/autocomplete/raw_autocomplete.0.dart",
"repo_id": "flutter",
"token_count": 1184
} | 749 |
// 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/material.dart';
/// Flutter code sample for [FractionallySizedBox].
void main() => runApp(const FractionallySizedBoxApp());
class FractionallySizedBoxApp extends StatelessWidget {
const FractionallySizedBoxApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('FractionallySizedBox Sample')),
body: const FractionallySizedBoxExample(),
),
);
}
}
class FractionallySizedBoxExample extends StatelessWidget {
const FractionallySizedBoxExample({super.key});
@override
Widget build(BuildContext context) {
return SizedBox.expand(
child: FractionallySizedBox(
widthFactor: 0.5,
heightFactor: 0.5,
alignment: FractionalOffset.center,
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.blue,
width: 4,
),
),
),
),
);
}
}
| flutter/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/basic/fractionally_sized_box.0.dart",
"repo_id": "flutter",
"token_count": 476
} | 750 |
// 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 'dart:typed_data';
import 'package:flutter/material.dart';
/// Flutter code sample for [EditableText.onContentInserted].
void main() => runApp(const KeyboardInsertedContentApp());
class KeyboardInsertedContentApp extends StatelessWidget {
const KeyboardInsertedContentApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: KeyboardInsertedContentDemo(),
);
}
}
class KeyboardInsertedContentDemo extends StatefulWidget {
const KeyboardInsertedContentDemo({super.key});
@override
State<KeyboardInsertedContentDemo> createState() => _KeyboardInsertedContentDemoState();
}
class _KeyboardInsertedContentDemoState extends State<KeyboardInsertedContentDemo> {
final TextEditingController _controller = TextEditingController();
Uint8List? bytes;
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Keyboard Inserted Content Sample')),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text("Here's a text field that supports inserting only png or gif content:"),
TextField(
controller: _controller,
contentInsertionConfiguration: ContentInsertionConfiguration(
allowedMimeTypes: const <String>['image/png', 'image/gif'],
onContentInserted: (KeyboardInsertedContent data) async {
if (data.data != null) {
setState(() {
bytes = data.data;
});
}
},
),
),
if (bytes != null) const Text("Here's the most recently inserted content:"),
if (bytes != null) Image.memory(bytes!),
],
),
);
}
}
| flutter/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/editable_text/editable_text.on_content_inserted.0.dart",
"repo_id": "flutter",
"token_count": 783
} | 751 |
// 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/material.dart';
/// Flutter code sample for [GestureDetector].
void main() => runApp(const GestureDetectorExampleApp());
class GestureDetectorExampleApp extends StatelessWidget {
const GestureDetectorExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: GestureDetectorExample(),
);
}
}
class GestureDetectorExample extends StatefulWidget {
const GestureDetectorExample({super.key});
@override
State<GestureDetectorExample> createState() => _GestureDetectorExampleState();
}
class _GestureDetectorExampleState extends State<GestureDetectorExample> {
Color _color = Colors.white;
@override
Widget build(BuildContext context) {
return Container(
color: _color,
height: 200.0,
width: 200.0,
child: GestureDetector(
onTap: () {
setState(() {
_color == Colors.yellow ? _color = Colors.white : _color = Colors.yellow;
});
},
),
);
}
}
| flutter/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/gesture_detector/gesture_detector.1.dart",
"repo_id": "flutter",
"token_count": 422
} | 752 |
// 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 'dart:math' as math;
import 'package:flutter/material.dart';
/// Flutter code sample for [InheritedNotifier].
void main() => runApp(const InheritedNotifierExampleApp());
class InheritedNotifierExampleApp extends StatelessWidget {
const InheritedNotifierExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: InheritedNotifierExample(),
);
}
}
class SpinModel extends InheritedNotifier<AnimationController> {
const SpinModel({
super.key,
super.notifier,
required super.child,
});
static double of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<SpinModel>()!.notifier!.value;
}
}
class Spinner extends StatelessWidget {
const Spinner({super.key});
@override
Widget build(BuildContext context) {
return Transform.rotate(
angle: SpinModel.of(context) * 2.0 * math.pi,
child: Container(
width: 100,
height: 100,
color: Colors.green,
child: const Center(
child: Text('Whee!'),
),
),
);
}
}
class InheritedNotifierExample extends StatefulWidget {
const InheritedNotifierExample({super.key});
@override
State<InheritedNotifierExample> createState() => _InheritedNotifierExampleState();
}
/// [AnimationController]s can be created with `vsync: this` because of
/// [TickerProviderStateMixin].
class _InheritedNotifierExampleState extends State<InheritedNotifierExample> with TickerProviderStateMixin {
late AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(seconds: 10),
vsync: this,
)..repeat();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return SpinModel(
notifier: _controller,
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
Spinner(),
Spinner(),
Spinner(),
],
),
);
}
}
| flutter/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/inherited_notifier/inherited_notifier.0.dart",
"repo_id": "flutter",
"token_count": 818
} | 753 |
// 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/material.dart';
/// Flutter code sample for [RestorableRouteFuture].
void main() => runApp(const RestorableRouteFutureExampleApp());
class RestorableRouteFutureExampleApp extends StatelessWidget {
const RestorableRouteFutureExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
restorationScopeId: 'app',
home: Scaffold(
appBar: AppBar(title: const Text('RestorableRouteFuture Example')),
body: const MyHome(),
),
);
}
}
class MyHome extends StatefulWidget {
const MyHome({super.key});
@override
State<MyHome> createState() => _MyHomeState();
}
class _MyHomeState extends State<MyHome> with RestorationMixin {
final RestorableInt _lastCount = RestorableInt(0);
late RestorableRouteFuture<int> _counterRoute;
@override
String get restorationId => 'home';
@override
void initState() {
super.initState();
_counterRoute = RestorableRouteFuture<int>(onPresent: (NavigatorState navigator, Object? arguments) {
// Defines what route should be shown (and how it should be added
// to the navigator) when `RestorableRouteFuture.present` is called.
return navigator.restorablePush(
_counterRouteBuilder,
arguments: arguments,
);
}, onComplete: (int count) {
// Defines what should happen with the return value when the route
// completes.
setState(() {
_lastCount.value = count;
});
});
}
@override
void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
// Register the `RestorableRouteFuture` with the state restoration framework.
registerForRestoration(_counterRoute, 'route');
registerForRestoration(_lastCount, 'count');
}
@override
void dispose() {
super.dispose();
_lastCount.dispose();
_counterRoute.dispose();
}
// A static `RestorableRouteBuilder` that can re-create the route during
// state restoration.
@pragma('vm:entry-point')
static Route<int> _counterRouteBuilder(BuildContext context, Object? arguments) {
return MaterialPageRoute<int>(
builder: (BuildContext context) => MyCounter(
title: arguments!.toString(),
),
);
}
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text('Last count: ${_lastCount.value}'),
ElevatedButton(
onPressed: () {
// Show the route defined by the `RestorableRouteFuture`.
_counterRoute.present('Awesome Counter');
},
child: const Text('Open Counter'),
),
],
),
);
}
}
// Widget for the route pushed by the `RestorableRouteFuture`.
class MyCounter extends StatefulWidget {
const MyCounter({super.key, required this.title});
final String title;
@override
State<MyCounter> createState() => _MyCounterState();
}
class _MyCounterState extends State<MyCounter> with RestorationMixin {
final RestorableInt _count = RestorableInt(0);
@override
String get restorationId => 'counter';
@override
void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
registerForRestoration(_count, 'count');
}
@override
void dispose() {
super.dispose();
_count.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
leading: BackButton(
onPressed: () {
// Return the current count of the counter from this route.
Navigator.of(context).pop(_count.value);
},
),
),
body: Center(
child: Text('Count: ${_count.value}'),
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.add),
onPressed: () {
setState(() {
_count.value++;
});
},
),
);
}
}
| flutter/examples/api/lib/widgets/navigator/restorable_route_future.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/navigator/restorable_route_future.0.dart",
"repo_id": "flutter",
"token_count": 1537
} | 754 |
// 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.
// This sample demonstrates showing a confirmation dialog before navigating
// away from a page.
import 'package:flutter/material.dart';
void main() => runApp(const NavigatorPopHandlerApp());
class NavigatorPopHandlerApp extends StatelessWidget {
const NavigatorPopHandlerApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
initialRoute: '/home',
routes: <String, WidgetBuilder>{
'/home': (BuildContext context) => const _HomePage(),
'/two': (BuildContext context) => const _PageTwo(),
},
);
}
}
class _HomePage extends StatefulWidget {
const _HomePage();
@override
State<_HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<_HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Page One'),
TextButton(
onPressed: () {
Navigator.of(context).pushNamed('/two');
},
child: const Text('Next page'),
),
],
),
),
);
}
}
class _PageTwo extends StatefulWidget {
const _PageTwo();
@override
State<_PageTwo> createState() => _PageTwoState();
}
class _PageTwoState extends State<_PageTwo> {
/// Shows a dialog and resolves to true when the user has indicated that they
/// want to pop.
///
/// A return value of null indicates a desire not to pop, such as when the
/// user has dismissed the modal without tapping a button.
Future<bool?> _showBackDialog() {
return showDialog<bool>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Are you sure?'),
content: const Text(
'Are you sure you want to leave this page?',
),
actions: <Widget>[
TextButton(
style: TextButton.styleFrom(
textStyle: Theme.of(context).textTheme.labelLarge,
),
child: const Text('Nevermind'),
onPressed: () {
Navigator.pop(context, false);
},
),
TextButton(
style: TextButton.styleFrom(
textStyle: Theme.of(context).textTheme.labelLarge,
),
child: const Text('Leave'),
onPressed: () {
Navigator.pop(context, true);
},
),
],
);
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Page Two'),
PopScope(
canPop: false,
onPopInvoked: (bool didPop) async {
if (didPop) {
return;
}
final bool shouldPop = await _showBackDialog() ?? false;
if (context.mounted && shouldPop) {
Navigator.pop(context);
}
},
child: TextButton(
onPressed: () async {
final bool shouldPop = await _showBackDialog() ?? false;
if (context.mounted && shouldPop) {
Navigator.pop(context);
}
},
child: const Text('Go back'),
),
),
],
),
),
);
}
}
| flutter/examples/api/lib/widgets/pop_scope/pop_scope.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/pop_scope/pop_scope.0.dart",
"repo_id": "flutter",
"token_count": 1783
} | 755 |
// 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/material.dart';
/// Flutter code sample for [RawScrollbar].
void main() => runApp(const RawScrollbarExampleApp());
class RawScrollbarExampleApp extends StatelessWidget {
const RawScrollbarExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('RawScrollbar Sample')),
body: const RawScrollbarExample(),
),
);
}
}
class RawScrollbarExample extends StatelessWidget {
const RawScrollbarExample({super.key});
@override
Widget build(BuildContext context) {
return RawScrollbar(
child: GridView.builder(
itemCount: 120,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
itemBuilder: (BuildContext context, int index) {
return Center(
child: Text('item $index'),
);
},
),
);
}
}
| flutter/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/scrollbar/raw_scrollbar.1.dart",
"repo_id": "flutter",
"token_count": 401
} | 756 |
// 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/material.dart';
void main() => runApp(const SliverCrossAxisGroupExampleApp());
class SliverCrossAxisGroupExampleApp extends StatelessWidget {
const SliverCrossAxisGroupExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('SliverCrossAxisGroup Sample')),
body: const SliverCrossAxisGroupExample(),
),
);
}
}
class SliverCrossAxisGroupExample extends StatelessWidget {
const SliverCrossAxisGroupExample({super.key});
@override
Widget build(BuildContext context) {
return CustomScrollView(
slivers: <Widget>[
SliverCrossAxisGroup(
slivers: <Widget>[
SliverList.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
color: index.isEven ? Colors.amber[300] : Colors.blue[300],
height: 100.0,
child: Center(
child: Text(
'Item $index',
style: const TextStyle(fontSize: 24),
),
),
);
},
itemCount: 5,
),
SliverConstrainedCrossAxis(
maxExtent: 200,
sliver: SliverList.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
color: index.isEven ? Colors.green[300] : Colors.red[300],
height: 100.0,
child: Center(
child: Text(
'Item ${index + 5}',
style: const TextStyle(fontSize: 24),
),
),
);
},
itemCount: 5,
),
),
SliverCrossAxisExpanded(
flex: 2,
sliver: SliverList.builder(
itemBuilder: (BuildContext context, int index) {
return Container(
color: index.isEven ? Colors.purple[300] : Colors.orange[300],
height: 100.0,
child: Center(
child: Text(
'Item ${index + 10}',
style: const TextStyle(fontSize: 24),
),
),
);
},
itemCount: 5,
),
),
],
),
],
);
}
}
| flutter/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/sliver/sliver_cross_axis_group.0.dart",
"repo_id": "flutter",
"token_count": 1524
} | 757 |
// 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/material.dart';
/// Flutter code sample for [DefaultTextStyleTransition].
void main() => runApp(const DefaultTextStyleTransitionExampleApp());
class DefaultTextStyleTransitionExampleApp extends StatelessWidget {
const DefaultTextStyleTransitionExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: DefaultTextStyleTransitionExample(),
);
}
}
class DefaultTextStyleTransitionExample extends StatefulWidget {
const DefaultTextStyleTransitionExample({super.key});
@override
State<DefaultTextStyleTransitionExample> createState() => _DefaultTextStyleTransitionExampleState();
}
/// [AnimationController]s can be created with `vsync: this` because of
/// [TickerProviderStateMixin].
class _DefaultTextStyleTransitionExampleState extends State<DefaultTextStyleTransitionExample>
with TickerProviderStateMixin {
late AnimationController _controller;
late TextStyleTween _styleTween;
late CurvedAnimation _curvedAnimation;
@override
void initState() {
super.initState();
_controller = AnimationController(
duration: const Duration(seconds: 2),
vsync: this,
)..repeat(reverse: true);
_styleTween = TextStyleTween(
begin: const TextStyle(fontSize: 50, color: Colors.blue, fontWeight: FontWeight.w900),
end: const TextStyle(fontSize: 50, color: Colors.red, fontWeight: FontWeight.w100),
);
_curvedAnimation = CurvedAnimation(
parent: _controller,
curve: Curves.elasticInOut,
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: DefaultTextStyleTransition(
style: _styleTween.animate(_curvedAnimation),
child: const Text('Flutter'),
),
);
}
}
| flutter/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart/0 | {
"file_path": "flutter/examples/api/lib/widgets/transitions/default_text_style_transition.0.dart",
"repo_id": "flutter",
"token_count": 644
} | 758 |
// 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/nav_bar/cupertino_sliver_nav_bar.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
const Offset dragUp = Offset(0.0, -150.0);
void main() {
testWidgets('Collapse and expand CupertinoSliverNavigationBar changes title position', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SliverNavBarApp(),
);
// Large title is visible and at lower position.
expect(tester.getBottomLeft(find.text('Contacts').first).dy, 88.0);
await tester.fling(find.text('Drag me up'), dragUp, 500.0);
await tester.pumpAndSettle();
// Large title is hidden and at higher position.
expect(tester.getBottomLeft(find.text('Contacts').first).dy, 36.0 + 8.0); // Static part + _kNavBarBottomPadding.
});
testWidgets('Middle widget is visible in both collapsed and expanded states', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SliverNavBarApp(),
);
// Navigate to a page that has both middle and large titles.
final Finder nextButton = find.text('Go to Next Page');
expect(nextButton, findsOneWidget);
await tester.tap(nextButton);
await tester.pumpAndSettle();
// Both middle and large titles are visible.
expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5);
expect(tester.getBottomLeft(find.text('Family').first).dy, 88.0);
await tester.fling(find.text('Drag me up'), dragUp, 500.0);
await tester.pumpAndSettle();
// Large title is hidden and middle title is visible.
expect(tester.getBottomLeft(find.text('Contacts Group').first).dy, 30.5);
expect(tester.getBottomLeft(find.text('Family').first).dy, 36.0 + 8.0); // Static part + _kNavBarBottomPadding.
});
testWidgets('CupertinoSliverNavigationBar with previous route has back button', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SliverNavBarApp(),
);
// Navigate to a page that has back button
final Finder nextButton = find.text('Go to Next Page');
expect(nextButton, findsOneWidget);
await tester.tap(nextButton);
await tester.pumpAndSettle();
expect(nextButton, findsNothing);
// Go back to the previous page.
final Finder backButton = find.byType(CupertinoButton);
expect(backButton, findsOneWidget);
await tester.tap(backButton);
await tester.pumpAndSettle();
expect(nextButton, findsOneWidget);
});
}
| flutter/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/cupertino/nav_bar/cupertino_sliver_nav_bar.0_test.dart",
"repo_id": "flutter",
"token_count": 918
} | 759 |
// 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/tab_scaffold/cupertino_tab_controller.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can switch tabs using CupertinoTabController', (WidgetTester tester) async {
await tester.pumpWidget(
const example.TabControllerApp(),
);
expect(find.text('Content of tab 0'), findsOneWidget);
await tester.tap(find.byIcon(CupertinoIcons.star_circle_fill));
await tester.pumpAndSettle();
expect(find.text('Content of tab 1'), findsOneWidget);
await tester.tap(find.text('Go to first tab'));
await tester.pumpAndSettle();
expect(find.text('Content of tab 0'), findsOneWidget);
});
}
| flutter/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/cupertino/tab_scaffold/cupertino_tab_controller.0_test.dart",
"repo_id": "flutter",
"token_count": 313
} | 760 |
// 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/material.dart';
import 'package:flutter_api_samples/material/app_bar/app_bar.3.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets(
'AppBar elevates when nested scroll view is scrolled underneath the AppBar',
(WidgetTester tester) async {
Material getMaterial() => tester.widget<Material>(find.descendant(
of: find.byType(AppBar),
matching: find.byType(Material),
));
await tester.pumpWidget(
const example.AppBarApp(),
);
// Starts with the base elevation.
expect(getMaterial().elevation, 0.0);
await tester.fling(find.text('Beach 3'), const Offset(0.0, -600.0), 2000.0);
await tester.pumpAndSettle();
// After scrolling it should be the scrolledUnderElevation.
expect(getMaterial().elevation, 4.0);
});
}
| flutter/examples/api/test/material/app_bar/app_bar.3_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/app_bar/app_bar.3_test.dart",
"repo_id": "flutter",
"token_count": 382
} | 761 |
// 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/material.dart';
import 'package:flutter_api_samples/material/card/card.2.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Card variants', (WidgetTester tester) async {
await tester.pumpWidget(const example.CardExamplesApp());
expect(find.byType(Card), findsNWidgets(3));
expect(find.widgetWithText(Card, 'Elevated Card'), findsOneWidget);
expect(find.widgetWithText(Card, 'Filled Card'), findsOneWidget);
expect(find.widgetWithText(Card, 'Outlined Card'), findsOneWidget);
Material getCardMaterial(WidgetTester tester, int cardIndex) {
return tester.widget<Material>(
find.descendant(
of: find.byType(Card).at(cardIndex),
matching: find.byType(Material),
),
);
}
final Material defaultCard = getCardMaterial(tester, 0);
expect(defaultCard.clipBehavior, Clip.none);
expect(defaultCard.elevation, 1.0);
expect(defaultCard.shape, const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12.0)),
));
expect(defaultCard.color, const Color(0xfff7f2fa));
expect(defaultCard.shadowColor, const Color(0xff000000));
expect(defaultCard.surfaceTintColor, Colors.transparent);
final Material filledCard = getCardMaterial(tester, 1);
expect(filledCard.clipBehavior, Clip.none);
expect(filledCard.elevation, 0.0);
expect(filledCard.shape, const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(12.0)),
));
expect(filledCard.color, const Color(0xffe6e0e9));
expect(filledCard.shadowColor, const Color(0xff000000));
expect(filledCard.surfaceTintColor, const Color(0x00000000));
final Material outlinedCard = getCardMaterial(tester, 2);
expect(outlinedCard.clipBehavior, Clip.none);
expect(outlinedCard.elevation, 0.0);
expect(outlinedCard.shape, const RoundedRectangleBorder(
side: BorderSide(color: Color(0xffcac4d0)),
borderRadius: BorderRadius.all(Radius.circular(12.0)),
));
expect(outlinedCard.color, const Color(0xfffef7ff));
expect(outlinedCard.shadowColor, const Color(0xff000000));
expect(outlinedCard.surfaceTintColor, Colors.transparent);
});
}
| flutter/examples/api/test/material/card/card.2_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/card/card.2_test.dart",
"repo_id": "flutter",
"token_count": 864
} | 762 |
// 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/material.dart';
import 'package:flutter_api_samples/material/data_table/data_table.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('DataTable Smoke Test', (WidgetTester tester) async {
await tester.pumpWidget(
const example.DataTableExampleApp(),
);
expect(find.widgetWithText(AppBar, 'DataTable Sample'), findsOneWidget);
expect(find.byType(DataTable), findsOneWidget);
final DataTable dataTable = tester.widget<DataTable>(find.byType(DataTable));
expect(dataTable.columns.length, 3);
expect(dataTable.rows.length, 3);
for (int i = 0; i < dataTable.rows.length; i++) {
expect(dataTable.rows[i].cells.length, 3);
}
expect(find.text('Name'), findsOneWidget);
expect(find.text('Age'), findsOneWidget);
expect(find.text('Role'), findsOneWidget);
expect(find.text('Sarah'), findsOneWidget);
expect(find.text('19'), findsOneWidget);
expect(find.text('Student'), findsOneWidget);
expect(find.text('Janine'), findsOneWidget);
expect(find.text('43'), findsOneWidget);
expect(find.text('Professor'), findsOneWidget);
expect(find.text('William'), findsOneWidget);
expect(find.text('27'), findsOneWidget);
expect(find.text('Associate Professor'), findsOneWidget);
});
}
| flutter/examples/api/test/material/data_table/data_table.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/data_table/data_table.0_test.dart",
"repo_id": "flutter",
"token_count": 510
} | 763 |
// 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/material.dart';
import 'package:flutter_api_samples/material/drawer/drawer.0.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Navigation bar updates destination on tap',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.DrawerApp(),
);
await tester.tap(find.byIcon(Icons.menu));
await tester.pumpAndSettle();
/// NavigationDestinations must be rendered
expect(find.text('Messages'), findsOneWidget);
expect(find.text('Profile'), findsOneWidget);
expect(find.text('Settings'), findsOneWidget);
/// Initial index must be zero
expect(find.text('Page: '), findsOneWidget);
/// Switch to second tab
await tester.tap(find.ancestor(of: find.text('Messages'), matching: find.byType(InkWell)));
await tester.pumpAndSettle();
expect(find.text('Page: Messages'), findsOneWidget);
/// Switch to third tab
await tester.tap(find.ancestor(of: find.text('Profile'), matching: find.byType(InkWell)));
await tester.pumpAndSettle();
expect(find.text('Page: Profile'), findsOneWidget);
/// Switch to fourth tab
await tester.tap(find.ancestor(of: find.text('Settings'), matching: find.byType(InkWell)));
await tester.pumpAndSettle();
expect(find.text('Page: Settings'), findsOneWidget);
});
}
| flutter/examples/api/test/material/drawer/drawer.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/drawer/drawer.0_test.dart",
"repo_id": "flutter",
"token_count": 531
} | 764 |
// 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/material.dart';
import 'package:flutter_api_samples/material/icon_button/icon_button.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('IconButton increments volume when tapped', (WidgetTester tester) async {
await tester.pumpWidget(
const example.IconButtonExampleApp(),
);
expect(find.byIcon(Icons.volume_up), findsOneWidget);
expect(find.text('Volume : 0.0'), findsOneWidget);
await tester.tap(find.byType(IconButton));
await tester.pumpAndSettle();
expect(find.text('Volume : 10.0'), findsOneWidget);
});
testWidgets('IconButton shows tooltip when long pressed', (WidgetTester tester) async {
await tester.pumpWidget(
const example.IconButtonExampleApp(),
);
expect(find.text('Increase volume by 10'), findsNothing);
await tester.longPress(find.byType(IconButton));
await tester.pumpAndSettle();
expect(find.text('Increase volume by 10'), findsOneWidget);
});
}
| flutter/examples/api/test/material/icon_button/icon_button.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/icon_button/icon_button.0_test.dart",
"repo_id": "flutter",
"token_count": 391
} | 765 |
// 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/material.dart';
import 'package:flutter_api_samples/material/list_tile/list_tile.1.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('ListTiles wrapped in Card widgets', (WidgetTester tester) async {
const int totalTiles = 7;
await tester.pumpWidget(
const example.ListTileApp(),
);
expect(find.byType(ListTile), findsNWidgets(totalTiles));
// The ListTile widget is wrapped in a Card widget.
for (int i = 0; i < totalTiles; i++) {
expect(
find.ancestor(
of: find.byType(ListTile).at(i),
matching: find.byType(Card).at(i),
),
findsOneWidget,
);
}
});
}
| flutter/examples/api/test/material/list_tile/list_tile.1_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/list_tile/list_tile.1_test.dart",
"repo_id": "flutter",
"token_count": 342
} | 766 |
// 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/material.dart';
import 'package:flutter_api_samples/material/navigation_rail/navigation_rail.1.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Navigation rail updates destination on tap',
(WidgetTester tester) async {
await tester.pumpWidget(
const example.NavigationRailExampleApp(),
);
final NavigationRail navigationRailWidget =
tester.firstWidget(find.byType(NavigationRail));
/// NavigationRailDestinations must be rendered
expect(find.text('First'), findsOneWidget);
expect(find.text('Second'), findsOneWidget);
expect(find.text('Third'), findsOneWidget);
/// initial index must be zero
expect(navigationRailWidget.selectedIndex, 0);
/// switch to second tab
await tester.tap(find.text('Second'));
await tester.pumpAndSettle();
expect(find.text('selectedIndex: 1'), findsOneWidget);
/// switch to third tab
await tester.tap(find.text('Third'));
await tester.pumpAndSettle();
expect(find.text('selectedIndex: 2'), findsOneWidget);
});
testWidgets('Navigation rail updates label type', (WidgetTester tester) async {
await tester.pumpWidget(
const example.NavigationRailExampleApp(),
);
// initial label type set to all.
expect(find.text('Label type: all'), findsOneWidget);
// switch to selected label type
await tester.tap(find.widgetWithText(ElevatedButton, 'Selected'));
await tester.pumpAndSettle();
expect(find.text('Label type: selected'), findsOneWidget);
// switch to none label type
await tester.tap(find.widgetWithText(ElevatedButton, 'None'));
await tester.pumpAndSettle();
expect(find.text('Label type: none'), findsOneWidget);
});
testWidgets('Navigation rail updates group alignment', (WidgetTester tester) async {
await tester.pumpWidget(
const example.NavigationRailExampleApp(),
);
// initial group alignment set top top.
expect(find.text('Group alignment: -1.0'), findsOneWidget);
// switch to center alignment
await tester.tap(find.widgetWithText(ElevatedButton, 'Center'));
await tester.pumpAndSettle();
expect(find.text('Group alignment: 0.0'), findsOneWidget);
// switch to bottom alignment
await tester.tap(find.widgetWithText(ElevatedButton, 'Bottom'));
await tester.pumpAndSettle();
expect(find.text('Group alignment: 1.0'), findsOneWidget);
});
testWidgets('Navigation rail shows leading/trailing widgets', (WidgetTester tester) async {
await tester.pumpWidget(
const example.NavigationRailExampleApp(),
);
// Initially leading/trailing widgets are hidden.
expect(find.byType(FloatingActionButton), findsNothing);
expect(find.byType(IconButton), findsNothing);
// Tap to show leading Widget.
await tester.tap(find.widgetWithText(ElevatedButton, 'Show Leading'));
await tester.pumpAndSettle();
expect(find.byType(FloatingActionButton), findsOneWidget);
expect(find.byType(IconButton), findsNothing);
// Tap to show trailing Widget.
await tester.tap(find.widgetWithText(ElevatedButton, 'Show Trailing'));
await tester.pumpAndSettle();
expect(find.byType(FloatingActionButton), findsOneWidget);
expect(find.byType(IconButton), findsOneWidget);
});
testWidgets('Destinations have badge', (WidgetTester tester) async {
await tester.pumpWidget(
const example.NavigationRailExampleApp(),
);
// Test badge without label.
final Badge notificationBadge = tester.firstWidget(find.ancestor(
of: find.byIcon(Icons.bookmark_border),
matching: find.byType(Badge),
));
expect(notificationBadge.label, null);
// Test badge with label.
final Badge messagesBadge = tester.firstWidget(find.ancestor(
of: find.byIcon(Icons.star_border),
matching: find.byType(Badge),
));
expect(messagesBadge.label, isNotNull);
});
}
| flutter/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/navigation_rail/navigation_rail.1_test.dart",
"repo_id": "flutter",
"token_count": 1403
} | 767 |
// 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/material.dart';
import 'package:flutter_api_samples/material/radio_list_tile/radio_list_tile.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can update RadioListTile group value', (WidgetTester tester) async {
await tester.pumpWidget(
const example.RadioListTileApp(),
);
// Find the number of RadioListTiles.
expect(find.byType(RadioListTile<example.SingingCharacter>), findsNWidgets(2));
// The initial group value is lafayette for the first RadioListTile.
RadioListTile<example.SingingCharacter> radioListTile = tester.widget(find.byType(RadioListTile<example.SingingCharacter>).first);
expect(radioListTile.groupValue, example.SingingCharacter.lafayette);
// The initial group value is lafayette for the last RadioListTile.
radioListTile = tester.widget(find.byType(RadioListTile<example.SingingCharacter>).last);
expect(radioListTile.groupValue, example.SingingCharacter.lafayette);
// Tap the last RadioListTile to change the group value to jefferson.
await tester.tap(find.byType(RadioListTile<example.SingingCharacter>).last);
await tester.pump();
// The group value is now jefferson for the first RadioListTile.
radioListTile = tester.widget(find.byType(RadioListTile<example.SingingCharacter>).first);
expect(radioListTile.groupValue, example.SingingCharacter.jefferson);
// The group value is now jefferson for the last RadioListTile.
radioListTile = tester.widget(find.byType(RadioListTile<example.SingingCharacter>).last);
expect(radioListTile.groupValue, example.SingingCharacter.jefferson);
});
}
| flutter/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/radio_list_tile/radio_list_tile.0_test.dart",
"repo_id": "flutter",
"token_count": 583
} | 768 |
// 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/material.dart';
import 'package:flutter_api_samples/material/segmented_button/segmented_button.1.dart'
as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Can use SegmentedButton.styleFrom to customize SegmentedButton', (WidgetTester tester) async {
await tester.pumpWidget(
const example.SegmentedButtonApp(),
);
final Color unselectedBackgroundColor = Colors.grey[200]!;
const Color unselectedForegroundColor = Colors.red;
const Color selectedBackgroundColor = Colors.green;
const Color selectedForegroundColor = Colors.white;
Material getMaterial(String text) {
return tester.widget<Material>(find.ancestor(
of: find.text(text),
matching: find.byType(Material),
).first);
}
// Verify the unselected button style.
expect(getMaterial('Day').textStyle?.color, unselectedForegroundColor);
expect(getMaterial('Day').color, unselectedBackgroundColor);
// Verify the selected button style.
expect(getMaterial('Week').textStyle?.color, selectedForegroundColor);
expect(getMaterial('Week').color, selectedBackgroundColor);
});
}
| flutter/examples/api/test/material/segmented_button/segmented_button.1_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/segmented_button/segmented_button.1_test.dart",
"repo_id": "flutter",
"token_count": 432
} | 769 |
// 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/material.dart';
import 'package:flutter_api_samples/material/tabs/tab_bar.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Switch tabs in the TabBar', (WidgetTester tester) async {
await tester.pumpWidget(
const example.TabBarApp(),
);
final TabBar tabBar = tester.widget<TabBar>(find.byType(TabBar));
expect(tabBar.tabs.length, 3);
final Finder tab1 = find.widgetWithIcon(Tab, Icons.cloud_outlined);
final Finder tab2 = find.widgetWithIcon(Tab, Icons.beach_access_sharp);
final Finder tab3 = find.widgetWithIcon(Tab, Icons.brightness_5_sharp);
const String tabBarViewText1 = "It's cloudy here";
const String tabBarViewText2 = "It's rainy here";
const String tabBarViewText3 = "It's sunny here";
expect(find.text(tabBarViewText1), findsNothing);
expect(find.text(tabBarViewText2), findsOneWidget);
expect(find.text(tabBarViewText3), findsNothing);
await tester.tap(tab1);
await tester.pumpAndSettle();
expect(find.text(tabBarViewText1), findsOneWidget);
expect(find.text(tabBarViewText2), findsNothing);
expect(find.text(tabBarViewText3), findsNothing);
await tester.tap(tab2);
await tester.pumpAndSettle();
expect(find.text(tabBarViewText1), findsNothing);
expect(find.text(tabBarViewText2), findsOneWidget);
expect(find.text(tabBarViewText3), findsNothing);
await tester.tap(tab3);
await tester.pumpAndSettle();
expect(find.text(tabBarViewText1), findsNothing);
expect(find.text(tabBarViewText2), findsNothing);
expect(find.text(tabBarViewText3), findsOneWidget);
});
}
| flutter/examples/api/test/material/tabs/tab_bar.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/material/tabs/tab_bar.0_test.dart",
"repo_id": "flutter",
"token_count": 655
} | 770 |
// 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/foundation.dart';
import 'package:flutter_api_samples/painting/image_provider/image_provider.0.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('$CustomNetworkImage', (WidgetTester tester) async {
const String expectedUrl = 'https://flutter.github.io/assets-for-api-docs/assets/widgets/flamingos.jpg?dpr=3.0&locale=en-US&platform=android&width=800.0&height=600.0&bidi=ltr';
final List<String> log = <String>[];
final DebugPrintCallback originalDebugPrint = debugPrint;
debugPrint = (String? message, {int? wrapWidth}) { log.add('$message'); };
await tester.pumpWidget(const ExampleApp());
expect(tester.takeException().toString(), 'Exception: Invalid image data');
expect(log, <String>['Fetching "$expectedUrl"...']);
debugPrint = originalDebugPrint;
});
}
| flutter/examples/api/test/painting/image_provider/image_provider.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/painting/image_provider/image_provider.0_test.dart",
"repo_id": "flutter",
"token_count": 338
} | 771 |
// 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/material.dart';
import 'package:flutter_api_samples/ui/text/font_feature.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('shows font features', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(
home: example.ExampleWidget(),
),
);
expect(find.byType(Text), findsNWidgets(9));
expect((tester.widget(find.byType(Text).at(0)) as Text).style!.fontSize, equals(18.0));
expect((tester.widget(find.byType(Text).at(1)) as Text).style!.fontFamily, equals('Cardo'));
expect((tester.widget(find.byType(Text).at(3)) as Text).style!.fontFeatures,
equals(const <FontFeature>[FontFeature.oldstyleFigures()]));
expect((tester.widget(find.byType(Text).at(5)) as Text).style!.fontFeatures,
equals(const <FontFeature>[FontFeature.alternativeFractions()]));
expect((tester.widget(find.byType(Text).at(8)) as Text).style!.fontFeatures,
equals(<FontFeature>[FontFeature.stylisticSet(1)]));
});
}
| flutter/examples/api/test/ui/text/font_feature.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/ui/text/font_feature.0_test.dart",
"repo_id": "flutter",
"token_count": 440
} | 772 |
// 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_api_samples/widgets/app_lifecycle_listener/app_lifecycle_listener.1.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('AppLifecycleListener example', (WidgetTester tester) async {
await tester.pumpWidget(
const example.AppLifecycleListenerExample(),
);
expect(find.text('Do Not Allow Exit'), findsOneWidget);
expect(find.text('Allow Exit'), findsOneWidget);
expect(find.text('Quit'), findsOneWidget);
expect(find.textContaining('Exit Request:'), findsOneWidget);
await tester.tap(find.text('Quit'));
await tester.pump();
// Responding to the quit request happens in a Future that we don't have
// visibility for, so to avoid a flaky test with a delay, we just check to
// see if the request string prefix is still there, rather than the request
// response string. Testing it wasn't worth exposing a Completer in the
// example code.
expect(find.textContaining('Exit Request:'), findsOneWidget);
});
}
| flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.1_test.dart/0 | {
"file_path": "flutter/examples/api/test/widgets/app_lifecycle_listener/app_lifecycle_listener.1_test.dart",
"repo_id": "flutter",
"token_count": 379
} | 773 |
// 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/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_api_samples/widgets/basic/mouse_region.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('MouseRegion detects mouse entries, exists, and location', (WidgetTester tester) async {
await tester.pumpWidget(
const MaterialApp(home: example.MouseRegionApp()),
);
expect(find.text('0 Entries\n0 Exits'), findsOneWidget);
expect(find.text('The cursor is here: (0.00, 0.00)'), findsOneWidget);
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
await gesture.addPointer();
await gesture.moveTo(tester.getCenter(find.byType(ColoredBox)));
await tester.pump();
expect(find.text('1 Entries\n0 Exits'), findsOneWidget);
expect(find.text('The cursor is here: (400.00, 328.00)'), findsOneWidget);
await gesture.moveTo(
tester.getCenter(find.byType(ColoredBox)) + const Offset(50.0, 30.0),
);
await tester.pump();
expect(find.text('The cursor is here: (450.00, 358.00)'), findsOneWidget);
await gesture.moveTo(Offset.zero);
await tester.pump();
expect(find.text('1 Entries\n1 Exits'), findsOneWidget);
});
}
| flutter/examples/api/test/widgets/basic/mouse_region.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/widgets/basic/mouse_region.0_test.dart",
"repo_id": "flutter",
"token_count": 509
} | 774 |
// 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/material.dart';
import 'package:flutter_api_samples/widgets/implicit_animations/animated_slide.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Translate FlutterLogo using AnimatedSlide', (WidgetTester tester) async {
await tester.pumpWidget(
const example.AnimatedSlideApp(),
);
Offset logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx, 376.0);
expect(logoOffset.dy, 304.0);
// Test Y axis slider.
final Offset y = tester.getCenter(find.text('Y'));
await tester.tapAt(Offset(y.dx, y.dy + 100));
await tester.pumpAndSettle();
logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 376.0);
expect(logoOffset.dy.roundToDouble(), 137.0);
// Test X axis slider.
final Offset x = tester.getCenter(find.text('X'));
await tester.tapAt(Offset(x.dx + 100, x.dy));
await tester.pumpAndSettle();
logoOffset = tester.getCenter(find.byType(FlutterLogo));
expect(logoOffset.dx.roundToDouble(), 178.0);
expect(logoOffset.dy.roundToDouble(), 137.0);
});
}
| flutter/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/widgets/implicit_animations/animated_slide.0_test.dart",
"repo_id": "flutter",
"token_count": 500
} | 775 |
// 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/material.dart';
import 'package:flutter_api_samples/widgets/scroll_notification_observer/scroll_notification_observer.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Scroll to top buttons appears when scrolling down', (WidgetTester tester) async {
const String buttonText = 'Scroll to top';
await tester.pumpWidget(
const example.ScrollNotificationObserverApp(),
);
expect(find.byType(ScrollNotificationObserver), findsOneWidget);
expect(find.text(buttonText), findsNothing);
// Scroll down.
await tester.drag(find.byType(ListView), const Offset(0.0, -300.0));
await tester.pumpAndSettle();
expect(find.text(buttonText), findsOneWidget);
await tester.tap(find.text(buttonText));
await tester.pumpAndSettle();
expect(find.text(buttonText), findsNothing);
});
}
| flutter/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/widgets/scroll_notification_observer/scroll_notification_observer.0_test.dart",
"repo_id": "flutter",
"token_count": 351
} | 776 |
// 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/material.dart';
import 'package:flutter_api_samples/widgets/transitions/listenable_builder.0.dart' as example;
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Changing focus changes border', (WidgetTester tester) async {
await tester.pumpWidget(const example.ListenableBuilderExample());
Finder findContainer() => find.descendant(of: find.byType(example.FocusListenerContainer), matching: find.byType(Container)).first;
Finder findChild() => find.descendant(of: findContainer(), matching: find.byType(Column)).first;
bool childHasFocus() => Focus.of(tester.element(findChild())).hasFocus;
Container getContainer() => tester.widget(findContainer()) as Container;
ShapeDecoration getDecoration() => getContainer().decoration! as ShapeDecoration;
OutlinedBorder getBorder() => getDecoration().shape as OutlinedBorder;
expect(find.text('Company'), findsOneWidget);
expect(find.text('First Name'), findsOneWidget);
expect(find.text('Last Name'), findsOneWidget);
await tester.tap(find.byType(TextField).first);
await tester.pumpAndSettle();
expect(childHasFocus(), isFalse);
expect(getBorder().side.width, equals(1));
expect(getContainer().color, isNull);
expect(getDecoration().color, isNull);
await tester.tap(find.byType(TextField).at(1));
await tester.pumpAndSettle();
expect(childHasFocus(), isTrue);
expect(getBorder().side.width, equals(4));
expect(getDecoration().color, equals(Colors.blue.shade50));
await tester.tap(find.byType(TextField).at(2));
await tester.pumpAndSettle();
expect(childHasFocus(), isTrue);
expect(getBorder().side.width, equals(4));
expect(getDecoration().color, equals(Colors.blue.shade50));
});
}
| flutter/examples/api/test/widgets/transitions/listenable_builder.0_test.dart/0 | {
"file_path": "flutter/examples/api/test/widgets/transitions/listenable_builder.0_test.dart",
"repo_id": "flutter",
"token_count": 636
} | 777 |
<!-- 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. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<io.flutter.embedding.android.FlutterView
android:id="@+id/flutter_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/grey"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/button_tap"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/button_tap"
android:layout_weight="1"
android:gravity="center"
android:textSize="@dimen/font_size"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/android"
android:layout_margin="@dimen/edge_margin"
android:textSize="@dimen/platform_label_font_size"
android:background="@color/grey"
/>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:elevation="@dimen/fab_elevation_resting"
app:pressedTranslationZ="@dimen/fab_elevation_pressed"
android:layout_margin="@dimen/edge_margin"
android:src="@drawable/ic_add_black_24dp"
android:clickable="true"
app:rippleColor="@color/grey"
app:fabSize="normal"
app:backgroundTint="@color/white"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</LinearLayout>
| flutter/examples/flutter_view/android/app/src/main/res/layout/flutter_view_layout.xml/0 | {
"file_path": "flutter/examples/flutter_view/android/app/src/main/res/layout/flutter_view_layout.xml",
"repo_id": "flutter",
"token_count": 900
} | 778 |
// 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.
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Runner.rc
//
#define IDI_APP_ICON 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
| flutter/examples/flutter_view/windows/runner/resource.h/0 | {
"file_path": "flutter/examples/flutter_view/windows/runner/resource.h",
"repo_id": "flutter",
"token_count": 242
} | 779 |
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
androidx.databinding:databinding-common:7.3.0=classpath
androidx.databinding:databinding-compiler-common:7.3.0=classpath
com.android.application:com.android.application.gradle.plugin:7.3.0=classpath
com.android.databinding:baseLibrary:7.3.0=classpath
com.android.tools.analytics-library:crash:30.3.0=classpath
com.android.tools.analytics-library:protos:30.3.0=classpath
com.android.tools.analytics-library:shared:30.3.0=classpath
com.android.tools.analytics-library:tracker:30.3.0=classpath
com.android.tools.build.jetifier:jetifier-core:1.0.0-beta10=classpath
com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta10=classpath
com.android.tools.build:aapt2-proto:7.3.0-8691043=classpath
com.android.tools.build:aaptcompiler:7.3.0=classpath
com.android.tools.build:apksig:7.3.0=classpath
com.android.tools.build:apkzlib:7.3.0=classpath
com.android.tools.build:builder-model:7.3.0=classpath
com.android.tools.build:builder-test-api:7.3.0=classpath
com.android.tools.build:builder:7.3.0=classpath
com.android.tools.build:bundletool:1.9.0=classpath
com.android.tools.build:gradle-api:7.3.0=classpath
com.android.tools.build:gradle:7.3.0=classpath
com.android.tools.build:manifest-merger:30.3.0=classpath
com.android.tools.build:transform-api:2.0.0-deprecated-use-gradle-api=classpath
com.android.tools.ddms:ddmlib:30.3.0=classpath
com.android.tools.layoutlib:layoutlib-api:30.3.0=classpath
com.android.tools.lint:lint-model:30.3.0=classpath
com.android.tools.lint:lint-typedef-remover:30.3.0=classpath
com.android.tools.utp:android-device-provider-ddmlib-proto:30.3.0=classpath
com.android.tools.utp:android-device-provider-gradle-proto:30.3.0=classpath
com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:30.3.0=classpath
com.android.tools.utp:android-test-plugin-host-coverage-proto:30.3.0=classpath
com.android.tools.utp:android-test-plugin-host-retention-proto:30.3.0=classpath
com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:30.3.0=classpath
com.android.tools:annotations:30.3.0=classpath
com.android.tools:common:30.3.0=classpath
com.android.tools:dvlib:30.3.0=classpath
com.android.tools:repository:30.3.0=classpath
com.android.tools:sdk-common:30.3.0=classpath
com.android.tools:sdklib:30.3.0=classpath
com.android:signflinger:7.3.0=classpath
com.android:zipflinger:7.3.0=classpath
com.github.gundy:semver4j:0.16.4=classpath
com.google.android:annotations:4.1.1.4=classpath
com.google.api.grpc:proto-google-common-protos:2.0.1=classpath
com.google.auto.value:auto-value-annotations:1.6.2=classpath
com.google.code.findbugs:jsr305:3.0.2=classpath
com.google.code.gson:gson:2.8.9=classpath
com.google.crypto.tink:tink:1.3.0-rc2=classpath
com.google.dagger:dagger:2.28.3=classpath
com.google.errorprone:error_prone_annotations:2.4.0=classpath
com.google.flatbuffers:flatbuffers-java:1.12.0=classpath
com.google.guava:failureaccess:1.0.1=classpath
com.google.guava:guava:30.1-jre=classpath
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=classpath
com.google.j2objc:j2objc-annotations:1.3=classpath
com.google.jimfs:jimfs:1.1=classpath
com.google.protobuf:protobuf-java-util:3.17.2=classpath
com.google.protobuf:protobuf-java:3.17.2=classpath
com.google.testing.platform:core-proto:0.0.8-alpha07=classpath
com.googlecode.json-simple:json-simple:1.1=classpath
com.googlecode.juniversalchardet:juniversalchardet:1.0.3=classpath
com.squareup:javapoet:1.10.0=classpath
com.squareup:javawriter:2.5.0=classpath
com.sun.activation:javax.activation:1.2.0=classpath
com.sun.istack:istack-commons-runtime:3.0.8=classpath
com.sun.xml.fastinfoset:FastInfoset:1.2.16=classpath
commons-codec:commons-codec:1.11=classpath
commons-io:commons-io:2.4=classpath
commons-logging:commons-logging:1.2=classpath
de.undercouch:gradle-download-task:4.1.1=classpath
io.grpc:grpc-api:1.39.0=classpath
io.grpc:grpc-context:1.39.0=classpath
io.grpc:grpc-core:1.39.0=classpath
io.grpc:grpc-netty:1.39.0=classpath
io.grpc:grpc-protobuf-lite:1.39.0=classpath
io.grpc:grpc-protobuf:1.39.0=classpath
io.grpc:grpc-stub:1.39.0=classpath
io.netty:netty-buffer:4.1.52.Final=classpath
io.netty:netty-codec-http2:4.1.52.Final=classpath
io.netty:netty-codec-http:4.1.52.Final=classpath
io.netty:netty-codec-socks:4.1.52.Final=classpath
io.netty:netty-codec:4.1.52.Final=classpath
io.netty:netty-common:4.1.52.Final=classpath
io.netty:netty-handler-proxy:4.1.52.Final=classpath
io.netty:netty-handler:4.1.52.Final=classpath
io.netty:netty-resolver:4.1.52.Final=classpath
io.netty:netty-transport:4.1.52.Final=classpath
io.perfmark:perfmark-api:0.23.0=classpath
it.unimi.dsi:fastutil:8.4.0=classpath
jakarta.activation:jakarta.activation-api:1.2.1=classpath
jakarta.xml.bind:jakarta.xml.bind-api:2.3.2=classpath
javax.annotation:javax.annotation-api:1.3.2=classpath
javax.inject:javax.inject:1=classpath
net.java.dev.jna:jna-platform:5.6.0=classpath
net.java.dev.jna:jna:5.6.0=classpath
net.sf.jopt-simple:jopt-simple:4.9=classpath
net.sf.kxml:kxml2:2.3.0=classpath
org.apache.commons:commons-compress:1.20=classpath
org.apache.httpcomponents:httpclient:4.5.13=classpath
org.apache.httpcomponents:httpcore:4.4.13=classpath
org.apache.httpcomponents:httpmime:4.5.6=classpath
org.bitbucket.b_c:jose4j:0.7.0=classpath
org.bouncycastle:bcpkix-jdk15on:1.67=classpath
org.bouncycastle:bcprov-jdk15on:1.67=classpath
org.checkerframework:checker-qual:3.5.0=classpath
org.codehaus.mojo:animal-sniffer-annotations:1.19=classpath
org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath
org.glassfish.jaxb:txw2:2.3.2=classpath
org.jdom:jdom2:2.0.6=classpath
org.jetbrains.intellij.deps:trove4j:1.0.20200330=classpath
org.jetbrains.kotlin.android:org.jetbrains.kotlin.android.gradle.plugin:1.7.10=classpath
org.jetbrains.kotlin:kotlin-android-extensions:1.7.10=classpath
org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.7.10=classpath
org.jetbrains.kotlin:kotlin-build-common:1.7.10=classpath
org.jetbrains.kotlin:kotlin-compiler-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-compiler-runner:1.7.10=classpath
org.jetbrains.kotlin:kotlin-daemon-client:1.7.10=classpath
org.jetbrains.kotlin:kotlin-daemon-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-idea:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.7.10=classpath
org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10=classpath
org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.7.10=classpath
org.jetbrains.kotlin:kotlin-native-utils:1.7.10=classpath
org.jetbrains.kotlin:kotlin-project-model:1.7.10=classpath
org.jetbrains.kotlin:kotlin-reflect:1.5.31=classpath
org.jetbrains.kotlin:kotlin-scripting-common:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.10=classpath
org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10=classpath
org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31=classpath
org.jetbrains.kotlin:kotlin-stdlib:1.5.31=classpath
org.jetbrains.kotlin:kotlin-tooling-core:1.7.10=classpath
org.jetbrains.kotlin:kotlin-tooling-metadata:1.7.10=classpath
org.jetbrains.kotlin:kotlin-util-io:1.7.10=classpath
org.jetbrains.kotlin:kotlin-util-klib:1.7.10=classpath
org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath
org.jetbrains:annotations:13.0=classpath
org.json:json:20180813=classpath
org.jvnet.staxex:stax-ex:1.8.1=classpath
org.ow2.asm:asm-analysis:9.1=classpath
org.ow2.asm:asm-commons:9.1=classpath
org.ow2.asm:asm-tree:9.1=classpath
org.ow2.asm:asm-util:9.1=classpath
org.ow2.asm:asm:9.1=classpath
org.slf4j:slf4j-api:1.7.30=classpath
org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2=classpath
xerces:xercesImpl:2.12.0=classpath
xml-apis:xml-apis:1.4.01=classpath
empty=
| flutter/examples/layers/android/buildscript-gradle.lockfile/0 | {
"file_path": "flutter/examples/layers/android/buildscript-gradle.lockfile",
"repo_id": "flutter",
"token_count": 3596
} | 780 |
// 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.
// This example shows how to put some pixels on the screen using the raw
// interface to the engine.
import 'dart:typed_data';
import 'dart:ui' as ui;
// The FlutterView into which this example will draw; set in the main method.
late final ui.FlutterView view;
late ui.Color color;
ui.Picture paint(ui.Rect paintBounds) {
// First we create a PictureRecorder to record the commands we're going to
// feed in the canvas. The PictureRecorder will eventually produce a Picture,
// which is an immutable record of those commands.
final ui.PictureRecorder recorder = ui.PictureRecorder();
// Next, we create a canvas from the recorder. The canvas is an interface
// which can receive drawing commands. The canvas interface is modeled after
// the SkCanvas interface from Skia. The paintBounds establishes a "cull rect"
// for the canvas, which lets the implementation discard any commands that
// are entirely outside this rectangle.
final ui.Canvas canvas = ui.Canvas(recorder, paintBounds);
// The commands draw a circle in the center of the screen.
final ui.Size size = paintBounds.size;
canvas.drawCircle(
size.center(ui.Offset.zero),
size.shortestSide * 0.45,
ui.Paint()..color = color,
);
// When we're done issuing painting commands, we end the recording an receive
// a Picture, which is an immutable record of the commands we've issued. You
// can draw a Picture into another canvas or include it as part of a
// composited scene.
return recorder.endRecording();
}
ui.Scene composite(ui.Picture picture, ui.Rect paintBounds) {
// The device pixel ratio gives an approximate ratio of the size of pixels on
// the device's screen to "normal" sized pixels. We commonly work in logical
// pixels, which are then scaled by the device pixel ratio before being drawn
// on the screen.
final double devicePixelRatio = view.devicePixelRatio;
// This transform scales the x and y coordinates by the devicePixelRatio.
final Float64List deviceTransform = Float64List(16)
..[0] = devicePixelRatio
..[5] = devicePixelRatio
..[10] = 1.0
..[15] = 1.0;
// We build a very simple scene graph with two nodes. The root node is a
// transform that scale its children by the device pixel ratio. This transform
// lets us paint in "logical" pixels which are converted to device pixels by
// this scaling operation.
final ui.SceneBuilder sceneBuilder = ui.SceneBuilder()
..pushTransform(deviceTransform)
..addPicture(ui.Offset.zero, picture)
..pop();
// When we're done recording the scene, we call build() to obtain an immutable
// record of the scene we've recorded.
return sceneBuilder.build();
}
void beginFrame(Duration timeStamp) {
final ui.Rect paintBounds = ui.Offset.zero & (view.physicalSize / view.devicePixelRatio);
// First, record a picture with our painting commands.
final ui.Picture picture = paint(paintBounds);
// Second, include that picture in a scene graph.
final ui.Scene scene = composite(picture, paintBounds);
// Third, instruct the engine to render that scene graph.
view.render(scene);
}
void handlePointerDataPacket(ui.PointerDataPacket packet) {
// The pointer packet contains a number of pointer movements, which we iterate
// through and process.
for (final ui.PointerData datum in packet.data) {
if (datum.change == ui.PointerChange.down) {
// If the pointer went down, we change the color of the circle to blue.
color = const ui.Color(0xFF0000FF);
// Rather than calling paint() synchronously, we ask the engine to
// schedule a frame. The engine will call onBeginFrame when it is actually
// time to produce the frame.
ui.PlatformDispatcher.instance.scheduleFrame();
} else if (datum.change == ui.PointerChange.up) {
// Similarly, if the pointer went up, we change the color of the circle to
// green and schedule a frame. It's harmless to call scheduleFrame many
// times because the engine will ignore redundant requests up until the
// point where the engine calls onBeginFrame, which signals the boundary
// between one frame and another.
color = const ui.Color(0xFF00FF00);
ui.PlatformDispatcher.instance.scheduleFrame();
}
}
}
// This function is the primary entry point to your application. The engine
// calls main() as soon as it has loaded your code.
void main() {
// TODO(goderbauer): Create a window if embedder doesn't provide an implicit view to draw into.
assert(ui.PlatformDispatcher.instance.implicitView != null);
view = ui.PlatformDispatcher.instance.implicitView!;
color = const ui.Color(0xFF00FF00);
// The engine calls onBeginFrame whenever it wants us to produce a frame.
ui.PlatformDispatcher.instance.onBeginFrame = beginFrame;
// The engine calls onPointerDataPacket whenever it had updated information
// about the pointers directed at our app.
ui.PlatformDispatcher.instance.onPointerDataPacket = handlePointerDataPacket;
// Here we kick off the whole process by asking the engine to schedule a new
// frame. The engine will eventually call onBeginFrame when it is time for us
// to actually produce the frame.
ui.PlatformDispatcher.instance.scheduleFrame();
}
| flutter/examples/layers/raw/touch_input.dart/0 | {
"file_path": "flutter/examples/layers/raw/touch_input.dart",
"repo_id": "flutter",
"token_count": 1570
} | 781 |
// 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_test/flutter_test.dart';
import '../../../widgets/media_query.dart' as demo;
void main() {
testWidgets('layers smoketest for widgets/media_query.dart', (WidgetTester tester) async {
demo.main();
});
}
| flutter/examples/layers/test/smoketests/widgets/media_query_test.dart/0 | {
"file_path": "flutter/examples/layers/test/smoketests/widgets/media_query_test.dart",
"repo_id": "flutter",
"token_count": 131
} | 782 |
// 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 "AppDelegate.h"
#import <Flutter/Flutter.h>
#import "GeneratedPluginRegistrant.h"
@implementation AppDelegate {
FlutterEventSink _eventSink;
}
- (BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
[GeneratedPluginRegistrant registerWithRegistry:self];
FlutterViewController* controller =
(FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* batteryChannel = [FlutterMethodChannel
methodChannelWithName:@"samples.flutter.io/battery"
binaryMessenger:controller];
__weak typeof(self) weakSelf = self;
[batteryChannel setMethodCallHandler:^(FlutterMethodCall* call,
FlutterResult result) {
if ([@"getBatteryLevel" isEqualToString:call.method]) {
int batteryLevel = [weakSelf getBatteryLevel];
if (batteryLevel == -1) {
result([FlutterError errorWithCode:@"UNAVAILABLE"
message:@"Battery info unavailable"
details:nil]);
} else {
result(@(batteryLevel));
}
} else {
result(FlutterMethodNotImplemented);
}
}];
FlutterEventChannel* chargingChannel = [FlutterEventChannel
eventChannelWithName:@"samples.flutter.io/charging"
binaryMessenger:controller];
[chargingChannel setStreamHandler:self];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (int)getBatteryLevel {
UIDevice* device = UIDevice.currentDevice;
device.batteryMonitoringEnabled = YES;
if (device.batteryState == UIDeviceBatteryStateUnknown) {
return -1;
} else {
return ((int)(device.batteryLevel * 100));
}
}
- (FlutterError*)onListenWithArguments:(id)arguments
eventSink:(FlutterEventSink)eventSink {
_eventSink = eventSink;
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
[self sendBatteryStateEvent];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(onBatteryStateDidChange:)
name:UIDeviceBatteryStateDidChangeNotification
object:nil];
return nil;
}
- (void)onBatteryStateDidChange:(NSNotification*)notification {
[self sendBatteryStateEvent];
}
- (void)sendBatteryStateEvent {
if (!_eventSink) return;
UIDeviceBatteryState state = [[UIDevice currentDevice] batteryState];
switch (state) {
case UIDeviceBatteryStateFull:
case UIDeviceBatteryStateCharging:
_eventSink(@"charging");
break;
case UIDeviceBatteryStateUnplugged:
_eventSink(@"discharging");
break;
default:
_eventSink([FlutterError errorWithCode:@"UNAVAILABLE"
message:@"Charging status unavailable"
details:nil]);
break;
}
}
- (FlutterError*)onCancelWithArguments:(id)arguments {
[[NSNotificationCenter defaultCenter] removeObserver:self];
_eventSink = nil;
return nil;
}
@end
| flutter/examples/platform_channel/ios/Runner/AppDelegate.m/0 | {
"file_path": "flutter/examples/platform_channel/ios/Runner/AppDelegate.m",
"repo_id": "flutter",
"token_count": 1245
} | 783 |
#include "../../Flutter/Flutter-Release.xcconfig"
#include "Warnings.xcconfig"
| flutter/examples/platform_view/macos/Runner/Configs/Release.xcconfig/0 | {
"file_path": "flutter/examples/platform_view/macos/Runner/Configs/Release.xcconfig",
"repo_id": "flutter",
"token_count": 32
} | 784 |
# 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.
# For details regarding the *Flutter Fix* feature, see
# https://flutter.dev/docs/development/tools/flutter-fix
# Please add new fixes to the top of the file, separated by one blank line
# from other fixes. In a comment, include a link to the PR where the change
# requiring the fix was made.
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
# file for instructions on testing these data driven fixes.
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are from the Cupertino library. *
version: 1
transforms:
# Change made in https://github.com/flutter/flutter/pull/20649
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
- title: "Replace with 'CupertinoPopupSurface'"
date: 2021-01-07
bulkApply: false
element:
uris: [ 'cupertino.dart' ]
class: 'CupertinoDialog'
changes:
- kind: 'rename'
newName: 'CupertinoPopupSurface'
# Change made in https://github.com/flutter/flutter/pull/20649
# TODO(Piinks): Add tests when `bulkApply:false` testing is supported, https://github.com/dart-lang/sdk/issues/44639
- title: "Replace with 'CupertinoAlertDialog'"
date: 2021-01-07
bulkApply: false
element:
uris: [ 'cupertino.dart' ]
class: 'CupertinoDialog'
changes:
- kind: 'rename'
newName: 'CupertinoAlertDialog'
- kind: 'renameParameter'
oldName: 'child'
newName: 'content'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'NoDefaultCupertinoThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoThemeData'
changes:
- kind: 'removeParameter'
name: 'nullOk'
# Changes made in https://github.com/flutter/flutter/pull/68736.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'brightnessOf'
inClass: 'CupertinoTheme'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeBrightnessOf'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'of'
inClass: 'CupertinoUserInterfaceLevel'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeOf'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolveFrom'
inClass: 'CupertinoDynamicColor'
changes:
- kind: 'removeParameter'
name: 'nullOk'
# Changes made in https://github.com/flutter/flutter/pull/68905.
- title: "Migrate from 'nullOk'"
date: 2021-01-27
element:
uris: [ 'cupertino.dart' ]
method: 'resolve'
inClass: 'CupertinoDynamicColor'
oneOf:
- if: "nullOk == 'true'"
changes:
- kind: 'rename'
newName: 'maybeResolve'
- kind: 'removeParameter'
name: 'nullOk'
- if: "nullOk == 'false'"
changes:
- kind: 'removeParameter'
name: 'nullOk'
variables:
nullOk:
kind: 'fragment'
value: 'arguments[nullOk]'
# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
field: 'maxLengthEnforced'
inClass: 'CupertinoTextField'
changes:
- kind: 'rename'
newName: 'maxLengthEnforcement'
# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
constructor: 'borderless'
inClass: 'CupertinoTextField'
oneOf:
- if: "maxLengthEnforced == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.enforce'
requiredIf: "maxLengthEnforced == 'true'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
- if: "maxLengthEnforced == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.none'
requiredIf: "maxLengthEnforced == 'false'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
variables:
maxLengthEnforced:
kind: 'fragment'
value: 'arguments[maxLengthEnforced]'
# Changes made in https://github.com/flutter/flutter/pull/72043
- title: "Migrate to 'maxLengthEnforcement'"
date: 2020-12-13
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoTextField'
oneOf:
- if: "maxLengthEnforced == 'true'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.enforce'
requiredIf: "maxLengthEnforced == 'true'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
- if: "maxLengthEnforced == 'false'"
changes:
- kind: 'addParameter'
index: 0
name: 'maxLengthEnforcement'
style: optional_named
argumentValue:
expression: 'MaxLengthEnforcement.none'
requiredIf: "maxLengthEnforced == 'false'"
- kind: 'removeParameter'
name: 'maxLengthEnforced'
variables:
maxLengthEnforced:
kind: 'fragment'
value: 'arguments[maxLengthEnforced]'
# Changes made in https://github.com/flutter/flutter/pull/96957
- title: "Migrate to 'thumbVisibility'"
date: 2022-01-20
element:
uris: [ 'cupertino.dart' ]
field: 'isAlwaysShown'
inClass: 'CupertinoScrollbar'
changes:
- kind: 'rename'
newName: 'thumbVisibility'
# Changes made in https://github.com/flutter/flutter/pull/96957
- title: "Migrate to 'thumbVisibility'"
date: 2022-01-20
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoScrollbar'
changes:
- kind: 'renameParameter'
oldName: 'isAlwaysShown'
newName: 'thumbVisibility'
# Changes made in https://github.com/flutter/flutter/pull/41859
- title: "Remove 'brightness'"
date: 2020-12-10
element:
uris: [ 'cupertino.dart' ]
constructor: ''
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'brightness'
# Changes made in https://github.com/flutter/flutter/pull/41859
- title: "Remove 'brightness'"
date: 2020-12-10
element:
uris: [ 'cupertino.dart' ]
method: 'copyWith'
inClass: 'CupertinoTextThemeData'
changes:
- kind: 'removeParameter'
name: 'brightness'
# Changes made in https://github.com/flutter/flutter/pull/78588
- title: "Migrate to 'buildOverscrollIndicator'"
date: 2021-03-18
element:
uris: [ 'cupertino.dart' ]
method: 'buildViewportChrome'
inClass: 'CupertinoScrollBehavior'
changes:
- kind: 'rename'
newName: 'buildOverscrollIndicator'
# Before adding a new fix: read instructions at the top of this file.
| flutter/packages/flutter/lib/fix_data/fix_cupertino.yaml/0 | {
"file_path": "flutter/packages/flutter/lib/fix_data/fix_cupertino.yaml",
"repo_id": "flutter",
"token_count": 4048
} | 785 |
# 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.
# For details regarding the *Flutter Fix* feature, see
# https://flutter.dev/docs/development/tools/flutter-fix
# Please add new fixes to the top of the file, separated by one blank line
# from other fixes. In a comment, include a link to the PR where the change
# requiring the fix was made.
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
# file for instructions on testing these data driven fixes.
# For documentation about this file format, see
# https://dart.dev/go/data-driven-fixes.
# * Fixes in this file are for DragTarget from the Widgets library. *
version: 1
transforms:
# Changes made in https://github.com/flutter/flutter/pull/133691
- title: "Migrate 'onWillAccept' to 'onWillAcceptWithDetails'"
date: 2023-08-30
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
constructor: ''
inClass: 'DragTarget'
changes:
- kind: 'renameParameter'
oldName: 'onWillAccept'
newName: 'onWillAcceptWithDetails'
# Changes made in https://github.com/flutter/flutter/pull/133691
- title: "Migrate 'onAccept' to 'onAcceptWithDetails'"
date: 2023-08-30
element:
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
constructor: ''
inClass: 'DragTarget'
changes:
- kind: 'renameParameter'
oldName: 'onAccept'
newName: 'onAcceptWithDetails'
# Before adding a new fix: read instructions at the top of this file.
| flutter/packages/flutter/lib/fix_data/fix_widgets/fix_drag_target.yaml/0 | {
"file_path": "flutter/packages/flutter/lib/fix_data/fix_widgets/fix_drag_target.yaml",
"repo_id": "flutter",
"token_count": 569
} | 786 |
// 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/foundation.dart';
import 'tween.dart';
export 'dart:ui' show VoidCallback;
export 'tween.dart' show Animatable;
// Examples can assume:
// late AnimationController _controller;
// late ValueNotifier<double> _scrollPosition;
/// The status of an animation.
enum AnimationStatus {
/// The animation is stopped at the beginning.
dismissed,
/// The animation is running from beginning to end.
forward,
/// The animation is running backwards, from end to beginning.
reverse,
/// The animation is stopped at the end.
completed,
}
/// Signature for listeners attached using [Animation.addStatusListener].
typedef AnimationStatusListener = void Function(AnimationStatus status);
/// Signature for method used to transform values in [Animation.fromValueListenable].
typedef ValueListenableTransformer<T> = T Function(T);
/// An animation with a value of type `T`.
///
/// An animation consists of a value (of type `T`) together with a status. The
/// status indicates whether the animation is conceptually running from
/// beginning to end or from the end back to the beginning, although the actual
/// value of the animation might not change monotonically (e.g., if the
/// animation uses a curve that bounces).
///
/// Animations also let other objects listen for changes to either their value
/// or their status. These callbacks are called during the "animation" phase of
/// the pipeline, just prior to rebuilding widgets.
///
/// To create a new animation that you can run forward and backward, consider
/// using [AnimationController].
///
/// See also:
///
/// * [Tween], which can be used to create [Animation] subclasses that
/// convert `Animation<double>`s into other kinds of [Animation]s.
abstract class Animation<T> extends Listenable implements ValueListenable<T> {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const Animation();
/// Create a new animation from a [ValueListenable].
///
/// The returned animation will always have an animations status of
/// [AnimationStatus.forward]. The value of the provided listenable can
/// be optionally transformed using the [transformer] function.
///
/// {@tool snippet}
///
/// This constructor can be used to replace instances of [ValueListenableBuilder]
/// widgets with a corresponding animated widget, like a [FadeTransition].
///
/// Before:
///
/// ```dart
/// Widget build(BuildContext context) {
/// return ValueListenableBuilder<double>(
/// valueListenable: _scrollPosition,
/// builder: (BuildContext context, double value, Widget? child) {
/// final double opacity = (value / 1000).clamp(0, 1);
/// return Opacity(opacity: opacity, child: child);
/// },
/// child: const ColoredBox(
/// color: Colors.red,
/// child: Text('Hello, Animation'),
/// ),
/// );
/// }
/// ```
///
/// {@end-tool}
/// {@tool snippet}
///
/// After:
///
/// ```dart
/// Widget build2(BuildContext context) {
/// return FadeTransition(
/// opacity: Animation<double>.fromValueListenable(_scrollPosition, transformer: (double value) {
/// return (value / 1000).clamp(0, 1);
/// }),
/// child: const ColoredBox(
/// color: Colors.red,
/// child: Text('Hello, Animation'),
/// ),
/// );
/// }
/// ```
/// {@end-tool}
factory Animation.fromValueListenable(ValueListenable<T> listenable, {
ValueListenableTransformer<T>? transformer,
}) = _ValueListenableDelegateAnimation<T>;
// keep these next five dartdocs in sync with the dartdocs in AnimationWithParentMixin<T>
/// Calls the listener every time the value of the animation changes.
///
/// Listeners can be removed with [removeListener].
@override
void addListener(VoidCallback listener);
/// Stop calling the listener every time the value of the animation changes.
///
/// If `listener` is not currently registered as a listener, this method does
/// nothing.
///
/// Listeners can be added with [addListener].
@override
void removeListener(VoidCallback listener);
/// Calls listener every time the status of the animation changes.
///
/// Listeners can be removed with [removeStatusListener].
void addStatusListener(AnimationStatusListener listener);
/// Stops calling the listener every time the status of the animation changes.
///
/// If `listener` is not currently registered as a status listener, this
/// method does nothing.
///
/// Listeners can be added with [addStatusListener].
void removeStatusListener(AnimationStatusListener listener);
/// The current status of this animation.
AnimationStatus get status;
/// The current value of the animation.
@override
T get value;
/// Whether this animation is stopped at the beginning.
bool get isDismissed => status == AnimationStatus.dismissed;
/// Whether this animation is stopped at the end.
bool get isCompleted => status == AnimationStatus.completed;
/// Chains a [Tween] (or [CurveTween]) to this [Animation].
///
/// This method is only valid for `Animation<double>` instances (i.e. when `T`
/// is `double`). This means, for instance, that it can be called on
/// [AnimationController] objects, as well as [CurvedAnimation]s,
/// [ProxyAnimation]s, [ReverseAnimation]s, [TrainHoppingAnimation]s, etc.
///
/// It returns an [Animation] specialized to the same type, `U`, as the
/// argument to the method (`child`), whose value is derived by applying the
/// given [Tween] to the value of this [Animation].
///
/// {@tool snippet}
///
/// Given an [AnimationController] `_controller`, the following code creates
/// an `Animation<Alignment>` that swings from top left to top right as the
/// controller goes from 0.0 to 1.0:
///
/// ```dart
/// Animation<Alignment> alignment1 = _controller.drive(
/// AlignmentTween(
/// begin: Alignment.topLeft,
/// end: Alignment.topRight,
/// ),
/// );
/// ```
/// {@end-tool}
/// {@tool snippet}
///
/// The `_alignment.value` could then be used in a widget's build method, for
/// instance, to position a child using an [Align] widget such that the
/// position of the child shifts over time from the top left to the top right.
///
/// It is common to ease this kind of curve, e.g. making the transition slower
/// at the start and faster at the end. The following snippet shows one way to
/// chain the alignment tween in the previous example to an easing curve (in
/// this case, [Curves.easeIn]). In this example, the tween is created
/// elsewhere as a variable that can be reused, since none of its arguments
/// vary.
///
/// ```dart
/// final Animatable<Alignment> tween = AlignmentTween(begin: Alignment.topLeft, end: Alignment.topRight)
/// .chain(CurveTween(curve: Curves.easeIn));
/// // ...
/// final Animation<Alignment> alignment2 = _controller.drive(tween);
/// ```
/// {@end-tool}
/// {@tool snippet}
///
/// The following code is exactly equivalent, and is typically clearer when
/// the tweens are created inline, as might be preferred when the tweens have
/// values that depend on other variables:
///
/// ```dart
/// Animation<Alignment> alignment3 = _controller
/// .drive(CurveTween(curve: Curves.easeIn))
/// .drive(AlignmentTween(
/// begin: Alignment.topLeft,
/// end: Alignment.topRight,
/// ));
/// ```
/// {@end-tool}
/// {@tool snippet}
///
/// This method can be paired with an [Animatable] created via
/// [Animatable.fromCallback] in order to transform an animation with a
/// callback function. This can be useful for performing animations that
/// do not have well defined start or end points. This example transforms
/// the current scroll position into a color that cycles through values
/// of red.
///
/// ```dart
/// Animation<Color> color = Animation<double>.fromValueListenable(_scrollPosition)
/// .drive(Animatable<Color>.fromCallback((double value) {
/// return Color.fromRGBO(value.round() % 255, 0, 0, 1);
/// }));
/// ```
///
/// {@end-tool}
///
/// See also:
///
/// * [Animatable.animate], which does the same thing.
/// * [AnimationController], which is usually used to drive animations.
/// * [CurvedAnimation], an alternative to [CurveTween] for applying easing
/// curves, which supports distinct curves in the forward direction and the
/// reverse direction.
/// * [Animatable.fromCallback], which allows creating an [Animatable] from an
/// arbitrary transformation.
@optionalTypeArgs
Animation<U> drive<U>(Animatable<U> child) {
assert(this is Animation<double>);
return child.animate(this as Animation<double>);
}
@override
String toString() {
return '${describeIdentity(this)}(${toStringDetails()})';
}
/// Provides a string describing the status of this object, but not including
/// information about the object itself.
///
/// This function is used by [Animation.toString] so that [Animation]
/// subclasses can provide additional details while ensuring all [Animation]
/// subclasses have a consistent [toString] style.
///
/// The result of this function includes an icon describing the status of this
/// [Animation] object:
///
/// * "▶": [AnimationStatus.forward] ([value] increasing)
/// * "◀": [AnimationStatus.reverse] ([value] decreasing)
/// * "⏭": [AnimationStatus.completed] ([value] == 1.0)
/// * "⏮": [AnimationStatus.dismissed] ([value] == 0.0)
String toStringDetails() {
return switch (status) {
AnimationStatus.forward => '\u25B6', // >
AnimationStatus.reverse => '\u25C0', // <
AnimationStatus.completed => '\u23ED', // >>|
AnimationStatus.dismissed => '\u23EE', // |<<
};
}
}
// An implementation of an animation that delegates to a value listenable with a fixed direction.
class _ValueListenableDelegateAnimation<T> extends Animation<T> {
_ValueListenableDelegateAnimation(this._listenable, {
ValueListenableTransformer<T>? transformer,
}) : _transformer = transformer;
final ValueListenable<T> _listenable;
final ValueListenableTransformer<T>? _transformer;
@override
void addListener(VoidCallback listener) {
_listenable.addListener(listener);
}
@override
void addStatusListener(AnimationStatusListener listener) {
// status will never change.
}
@override
void removeListener(VoidCallback listener) {
_listenable.removeListener(listener);
}
@override
void removeStatusListener(AnimationStatusListener listener) {
// status will never change.
}
@override
AnimationStatus get status => AnimationStatus.forward;
@override
T get value => _transformer?.call(_listenable.value) ?? _listenable.value;
}
| flutter/packages/flutter/lib/src/animation/animation.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/animation/animation.dart",
"repo_id": "flutter",
"token_count": 3269
} | 787 |
// 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 'dart:math' as math;
import 'dart:ui' as ui;
import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart' show HapticFeedback;
import 'package:flutter/widgets.dart';
import 'colors.dart';
import 'localizations.dart';
// The scale of the child at the time that the CupertinoContextMenu opens.
// This value was eyeballed from a physical device running iOS 13.1.2.
const double _kOpenScale = 1.15;
// The ratio for the borderRadius of the context menu preview image. This value
// was eyeballed by overlapping the CupertinoContextMenu with a context menu
// from iOS 16.0 in the XCode iPhone simulator.
const double _previewBorderRadiusRatio = 12.0;
// The duration of the transition used when a modal popup is shown. Eyeballed
// from a physical device running iOS 13.1.2.
const Duration _kModalPopupTransitionDuration = Duration(milliseconds: 335);
// The duration it takes for the CupertinoContextMenu to open.
// This value was eyeballed from the XCode simulator running iOS 16.0.
const Duration _previewLongPressTimeout = Duration(milliseconds: 800);
// The total length of the combined animations until the menu is fully open.
final int _animationDuration =
_previewLongPressTimeout.inMilliseconds + _kModalPopupTransitionDuration.inMilliseconds;
// The final box shadow for the opening child widget.
// This value was eyeballed from the XCode simulator running iOS 16.0.
const List<BoxShadow> _endBoxShadow = <BoxShadow>[
BoxShadow(
color: Color(0x40000000),
blurRadius: 10.0,
spreadRadius: 0.5,
),
];
const Color _borderColor = CupertinoDynamicColor.withBrightness(
color: Color(0xFFA9A9AF),
darkColor: Color(0xFF57585A),
);
typedef _DismissCallback = void Function(
BuildContext context,
double scale,
double opacity,
);
/// A function that builds the child and handles the transition between the
/// default child and the preview when the CupertinoContextMenu is open.
typedef CupertinoContextMenuBuilder = Widget Function(
BuildContext context,
Animation<double> animation,
);
// Given a GlobalKey, return the Rect of the corresponding RenderBox's
// paintBounds in global coordinates.
Rect _getRect(GlobalKey globalKey) {
assert(globalKey.currentContext != null);
final RenderBox renderBoxContainer = globalKey.currentContext!.findRenderObject()! as RenderBox;
return Rect.fromPoints(renderBoxContainer.localToGlobal(
renderBoxContainer.paintBounds.topLeft,
), renderBoxContainer.localToGlobal(
renderBoxContainer.paintBounds.bottomRight
));
}
// The context menu arranges itself slightly differently based on the location
// on the screen of [CupertinoContextMenu.child] before the
// [CupertinoContextMenu] opens.
enum _ContextMenuLocation {
center,
left,
right,
}
/// A full-screen modal route that opens when the [child] is long-pressed.
///
/// When open, the [CupertinoContextMenu] shows the child in a large full-screen
/// [Overlay] with a list of buttons specified by [actions]. The child/preview is
/// placed in an [Expanded] widget so that it will grow to fill the Overlay if
/// its size is unconstrained.
///
/// When closed, the [CupertinoContextMenu] displays the child as if the
/// [CupertinoContextMenu] were not there. Sizing and positioning is unaffected.
/// The menu can be closed like other [PopupRoute]s, such as by tapping the
/// background or by calling `Navigator.pop(context)`. Unlike [PopupRoute], it can
/// also be closed by swiping downwards.
///
/// {@tool dartpad}
/// This sample shows a very simple [CupertinoContextMenu] for the Flutter logo.
/// Long press on it to open.
///
/// ** See code in examples/api/lib/cupertino/context_menu/cupertino_context_menu.0.dart **
/// {@end-tool}
///
/// {@tool dartpad}
/// This sample shows a similar CupertinoContextMenu, this time using [builder]
/// to add a border radius to the widget.
///
/// ** See code in examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart **
/// {@end-tool}
///
/// See also:
///
/// * <https://developer.apple.com/design/human-interface-guidelines/ios/controls/context-menus/>
class CupertinoContextMenu extends StatefulWidget {
/// Create a context menu.
///
/// The [actions] parameter cannot be empty.
CupertinoContextMenu({
super.key,
required this.actions,
required Widget this.child,
this.enableHapticFeedback = false,
}) : assert(actions.isNotEmpty),
builder = ((BuildContext context, Animation<double> animation) => child);
/// Creates a context menu with a custom [builder] controlling the widget.
///
/// Use instead of the default constructor when it is needed to have a more
/// custom animation.
///
/// The [actions] parameter cannot be empty.
CupertinoContextMenu.builder({
super.key,
required this.actions,
required this.builder,
this.enableHapticFeedback = false,
}) : assert(actions.isNotEmpty),
child = null;
/// Exposes the default border radius for matching iOS 16.0 behavior. This
/// value was eyeballed from the iOS simulator running iOS 16.0.
///
/// {@tool snippet}
///
/// Below is example code in order to match the default border radius for an
/// iOS 16.0 open preview.
///
/// ```dart
/// CupertinoContextMenu.builder(
/// actions: <Widget>[
/// CupertinoContextMenuAction(
/// child: const Text('Action one'),
/// onPressed: () {},
/// ),
/// ],
/// builder:(BuildContext context, Animation<double> animation) {
/// final Animation<BorderRadius?> borderRadiusAnimation = BorderRadiusTween(
/// begin: BorderRadius.circular(0.0),
/// end: BorderRadius.circular(CupertinoContextMenu.kOpenBorderRadius),
/// ).animate(
/// CurvedAnimation(
/// parent: animation,
/// curve: Interval(
/// CupertinoContextMenu.animationOpensAt,
/// 1.0,
/// ),
/// ),
/// );
///
/// final Animation<Decoration> boxDecorationAnimation = DecorationTween(
/// begin: const BoxDecoration(
/// boxShadow: <BoxShadow>[],
/// ),
/// end: const BoxDecoration(
/// boxShadow: CupertinoContextMenu.kEndBoxShadow,
/// ),
/// ).animate(
/// CurvedAnimation(
/// parent: animation,
/// curve: Interval(
/// 0.0,
/// CupertinoContextMenu.animationOpensAt,
/// ),
/// )
/// );
///
/// return Container(
/// decoration:
/// animation.value < CupertinoContextMenu.animationOpensAt ? boxDecorationAnimation.value : null,
/// child: FittedBox(
/// fit: BoxFit.cover,
/// child: ClipRRect(
/// borderRadius: borderRadiusAnimation.value ?? BorderRadius.circular(0.0),
/// child: SizedBox(
/// height: 150,
/// width: 150,
/// child: Image.network('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'),
/// ),
/// ),
/// )
/// );
/// },
/// )
/// ```
///
/// {@end-tool}
static const double kOpenBorderRadius = _previewBorderRadiusRatio;
/// Exposes the final box shadow of the opening animation of the child widget
/// to match the default behavior of the native iOS widget. This value was
/// eyeballed from the iOS simulator running iOS 16.0.
static const List<BoxShadow> kEndBoxShadow = _endBoxShadow;
/// The point at which the CupertinoContextMenu begins to animate
/// into the open position.
///
/// A value between 0.0 and 1.0 corresponding to a point in [builder]'s
/// animation. When passing in an animation to [builder] the range before
/// [animationOpensAt] will correspond to the animation when the widget is
/// pressed and held, and the range after is the animation as the menu is
/// fully opening. For an example, see the documentation for [builder].
static final double animationOpensAt =
_previewLongPressTimeout.inMilliseconds / _animationDuration;
/// A function that returns a widget to be used alternatively from [child].
///
/// The widget returned by the function will be shown at all times: when the
/// [CupertinoContextMenu] is closed, when it is in the middle of opening,
/// and when it is fully open. This will overwrite the default animation that
/// matches the behavior of an iOS 16.0 context menu.
///
/// This builder can be used instead of the child when the intended child has
/// a property that would conflict with the default animation, such as a
/// border radius or a shadow, or if a more custom animation is needed.
///
/// In addition to the current [BuildContext], the function is also called
/// with an [Animation]. The complete animation goes from 0 to 1 when
/// the CupertinoContextMenu opens, and from 1 to 0 when it closes, and it can
/// be used to animate the widget in sync with this opening and closing.
///
/// The animation works in two stages. The first happens on press and hold of
/// the widget from 0 to [animationOpensAt], and the second stage for when the
/// widget fully opens up to the menu, from [animationOpensAt] to 1.
///
/// {@tool snippet}
///
/// Below is an example of using [builder] to show an image tile setup to be
/// opened in the default way to match a native iOS 16.0 app. The behavior
/// will match what will happen if the simple child image was passed as just
/// the [child] parameter, instead of [builder]. This can be manipulated to
/// add more customizability to the widget's animation.
///
/// ```dart
/// CupertinoContextMenu.builder(
/// actions: <Widget>[
/// CupertinoContextMenuAction(
/// child: const Text('Action one'),
/// onPressed: () {},
/// ),
/// ],
/// builder:(BuildContext context, Animation<double> animation) {
/// final Animation<BorderRadius?> borderRadiusAnimation = BorderRadiusTween(
/// begin: BorderRadius.circular(0.0),
/// end: BorderRadius.circular(CupertinoContextMenu.kOpenBorderRadius),
/// ).animate(
/// CurvedAnimation(
/// parent: animation,
/// curve: Interval(
/// CupertinoContextMenu.animationOpensAt,
/// 1.0,
/// ),
/// ),
/// );
///
/// final Animation<Decoration> boxDecorationAnimation = DecorationTween(
/// begin: const BoxDecoration(
/// boxShadow: <BoxShadow>[],
/// ),
/// end: const BoxDecoration(
/// boxShadow: CupertinoContextMenu.kEndBoxShadow,
/// ),
/// ).animate(
/// CurvedAnimation(
/// parent: animation,
/// curve: Interval(
/// 0.0,
/// CupertinoContextMenu.animationOpensAt,
/// ),
/// ),
/// );
///
/// return Container(
/// decoration:
/// animation.value < CupertinoContextMenu.animationOpensAt ? boxDecorationAnimation.value : null,
/// child: FittedBox(
/// fit: BoxFit.cover,
/// child: ClipRRect(
/// borderRadius: borderRadiusAnimation.value ?? BorderRadius.circular(0.0),
/// child: SizedBox(
/// height: 150,
/// width: 150,
/// child: Image.network('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl-2.jpg'),
/// ),
/// ),
/// ),
/// );
/// },
/// )
/// ```
///
/// {@end-tool}
///
/// {@tool dartpad}
/// Additionally below is an example of a real world use case for [builder].
///
/// If a widget is passed to the [child] parameter with properties that
/// conflict with the default animation, in this case the border radius,
/// unwanted behaviors can arise. Here a boxed shadow will wrap the widget as
/// it is expanded. To handle this, a more custom animation and widget can be
/// passed to the builder, using values exposed by [CupertinoContextMenu],
/// like [CupertinoContextMenu.kEndBoxShadow], to match the native iOS
/// animation as close as desired.
///
/// ** See code in examples/api/lib/cupertino/context_menu/cupertino_context_menu.1.dart **
/// {@end-tool}
final CupertinoContextMenuBuilder builder;
// TODO(mitchgoodwin): deprecate [child] with builder refactor https://github.com/flutter/flutter/issues/116306
/// The widget that can be "opened" with the [CupertinoContextMenu].
///
/// When the [CupertinoContextMenu] is long-pressed, the menu will open and
/// this widget will be moved to the new route and placed inside of an
/// [Expanded] widget. This allows the child to resize to fit in its place in
/// the new route, if it doesn't size itself.
///
/// When the [CupertinoContextMenu] is "closed", this widget acts like a
/// [Container], i.e. it does not constrain its child's size or affect its
/// position.
final Widget? child;
/// The actions that are shown in the menu.
///
/// These actions are typically [CupertinoContextMenuAction]s.
///
/// This parameter must not be empty.
final List<Widget> actions;
/// If true, clicking on the [CupertinoContextMenuAction]s will
/// produce haptic feedback.
///
/// Uses [HapticFeedback.heavyImpact] when activated.
/// Defaults to false.
final bool enableHapticFeedback;
@override
State<CupertinoContextMenu> createState() => _CupertinoContextMenuState();
}
class _CupertinoContextMenuState extends State<CupertinoContextMenu> with TickerProviderStateMixin {
final GlobalKey _childGlobalKey = GlobalKey();
bool _childHidden = false;
// Animates the child while it's opening.
late AnimationController _openController;
Rect? _decoyChildEndRect;
OverlayEntry? _lastOverlayEntry;
_ContextMenuRoute<void>? _route;
final double _midpoint = CupertinoContextMenu.animationOpensAt / 2;
late final TapGestureRecognizer _tapGestureRecognizer;
@override
void initState() {
super.initState();
_openController = AnimationController(
duration: _previewLongPressTimeout,
vsync: this,
upperBound: CupertinoContextMenu.animationOpensAt,
);
_openController.addStatusListener(_onDecoyAnimationStatusChange);
_tapGestureRecognizer = TapGestureRecognizer()
..onTapCancel = _onTapCancel
..onTapDown = _onTapDown
..onTapUp = _onTapUp
..onTap = _onTap;
}
void _listenerCallback() {
if (_openController.status != AnimationStatus.reverse &&
_openController.value >= _midpoint) {
if (widget.enableHapticFeedback) {
HapticFeedback.heavyImpact();
}
_tapGestureRecognizer.resolve(GestureDisposition.accepted);
_openController.removeListener(_listenerCallback);
}
}
// Determine the _ContextMenuLocation based on the location of the original
// child in the screen.
//
// The location of the original child is used to determine how to horizontally
// align the content of the open CupertinoContextMenu. For example, if the
// child is near the center of the screen, it will also appear in the center
// of the screen when the menu is open, and the actions will be centered below
// it.
_ContextMenuLocation get _contextMenuLocation {
final Rect childRect = _getRect(_childGlobalKey);
final double screenWidth = MediaQuery.sizeOf(context).width;
final double center = screenWidth / 2;
final bool centerDividesChild = childRect.left < center
&& childRect.right > center;
final double distanceFromCenter = (center - childRect.center.dx).abs();
if (centerDividesChild && distanceFromCenter <= childRect.width / 4) {
return _ContextMenuLocation.center;
}
if (childRect.center.dx > center) {
return _ContextMenuLocation.right;
}
return _ContextMenuLocation.left;
}
/// The default preview builder if none is provided. It makes a rectangle
/// around the child widget with rounded borders, matching the iOS 16 opened
/// context menu eyeballed on the XCode iOS simulator.
static Widget _defaultPreviewBuilder(BuildContext context, Animation<double> animation, Widget child) {
return FittedBox(
fit: BoxFit.cover,
child: ClipRRect(
borderRadius: BorderRadius.circular(_previewBorderRadiusRatio * animation.value),
child: child,
),
);
}
// Push the new route and open the CupertinoContextMenu overlay.
void _openContextMenu() {
setState(() {
_childHidden = true;
});
_route = _ContextMenuRoute<void>(
actions: widget.actions,
barrierLabel: CupertinoLocalizations.of(context).menuDismissLabel,
filter: ui.ImageFilter.blur(
sigmaX: 5.0,
sigmaY: 5.0,
),
contextMenuLocation: _contextMenuLocation,
previousChildRect: _decoyChildEndRect!,
builder: (BuildContext context, Animation<double> animation) {
if (widget.child == null) {
final Animation<double> localAnimation = Tween<double>(begin: CupertinoContextMenu.animationOpensAt, end: 1).animate(animation);
return widget.builder(context, localAnimation);
}
return _defaultPreviewBuilder(context, animation, widget.child!);
},
);
Navigator.of(context, rootNavigator: true).push<void>(_route!);
_route!.animation!.addStatusListener(_routeAnimationStatusListener);
}
void _onDecoyAnimationStatusChange(AnimationStatus animationStatus) {
switch (animationStatus) {
case AnimationStatus.dismissed:
if (_route == null) {
setState(() {
_childHidden = false;
});
}
_lastOverlayEntry?.remove();
_lastOverlayEntry?.dispose();
_lastOverlayEntry = null;
case AnimationStatus.completed:
setState(() {
_childHidden = true;
});
_openContextMenu();
// Keep the decoy on the screen for one extra frame. We have to do this
// because _ContextMenuRoute renders its first frame offscreen.
// Otherwise there would be a visible flash when nothing is rendered for
// one frame.
SchedulerBinding.instance.addPostFrameCallback((Duration _) {
_lastOverlayEntry?.remove();
_lastOverlayEntry?.dispose();
_lastOverlayEntry = null;
_openController.reset();
}, debugLabel: 'removeContextMenuDecoy');
case AnimationStatus.forward:
case AnimationStatus.reverse:
return;
}
}
// Watch for when _ContextMenuRoute is closed and return to the state where
// the CupertinoContextMenu just behaves as a Container.
void _routeAnimationStatusListener(AnimationStatus status) {
if (status != AnimationStatus.dismissed) {
return;
}
if (mounted) {
setState(() {
_childHidden = false;
});
}
_route!.animation!.removeStatusListener(_routeAnimationStatusListener);
_route = null;
}
void _onTap() {
_openController.removeListener(_listenerCallback);
if (_openController.isAnimating && _openController.value < _midpoint) {
_openController.reverse();
}
}
void _onTapCancel() {
_openController.removeListener(_listenerCallback);
if (_openController.isAnimating && _openController.value < _midpoint) {
_openController.reverse();
}
}
void _onTapUp(TapUpDetails details) {
_openController.removeListener(_listenerCallback);
if (_openController.isAnimating && _openController.value < _midpoint) {
_openController.reverse();
}
}
void _onTapDown(TapDownDetails details) {
_openController.addListener(_listenerCallback);
setState(() {
_childHidden = true;
});
final Rect childRect = _getRect(_childGlobalKey);
_decoyChildEndRect = Rect.fromCenter(
center: childRect.center,
width: childRect.width * _kOpenScale,
height: childRect.height * _kOpenScale,
);
// Create a decoy child in an overlay directly on top of the original child.
// TODO(justinmc): There is a known inconsistency with native here, due to
// doing the bounce animation using a decoy in the top level Overlay. The
// decoy will pop on top of the AppBar if the child is partially behind it,
// such as a top item in a partially scrolled view. However, if we don't use
// an overlay, then the decoy will appear behind its neighboring widget when
// it expands. This may be solvable by adding a widget to Scaffold that's
// underneath the AppBar.
_lastOverlayEntry = OverlayEntry(
builder: (BuildContext context) {
return _DecoyChild(
beginRect: childRect,
controller: _openController,
endRect: _decoyChildEndRect,
builder: widget.builder,
child: widget.child,
);
},
);
Overlay.of(context, rootOverlay: true, debugRequiredFor: widget).insert(_lastOverlayEntry!);
_openController.forward();
}
@override
Widget build(BuildContext context) {
return MouseRegion(
cursor: kIsWeb ? SystemMouseCursors.click : MouseCursor.defer,
child: Listener(
onPointerDown: _tapGestureRecognizer.addPointer,
child: TickerMode(
enabled: !_childHidden,
child: Visibility.maintain(
key: _childGlobalKey,
visible: !_childHidden,
child: widget.builder(context, _openController),
),
),
),
);
}
@override
void dispose() {
_tapGestureRecognizer.dispose();
_openController.dispose();
super.dispose();
}
}
// A floating copy of the CupertinoContextMenu's child.
//
// When the child is pressed, but before the CupertinoContextMenu opens, it does
// an animation where it slowly grows. This is implemented by hiding the
// original child and placing _DecoyChild on top of it in an Overlay. The use of
// an Overlay allows the _DecoyChild to appear on top of siblings of the
// original child.
class _DecoyChild extends StatefulWidget {
const _DecoyChild({
this.beginRect,
required this.controller,
this.endRect,
this.child,
this.builder,
});
final Rect? beginRect;
final AnimationController controller;
final Rect? endRect;
final Widget? child;
final CupertinoContextMenuBuilder? builder;
@override
_DecoyChildState createState() => _DecoyChildState();
}
class _DecoyChildState extends State<_DecoyChild> with TickerProviderStateMixin {
late Animation<Rect?> _rect;
late Animation<Decoration> _boxDecoration;
@override
void initState() {
super.initState();
const double beginPause = 1.0;
const double openAnimationLength = 5.0;
const double totalOpenAnimationLength = beginPause + openAnimationLength;
final double endPause =
((totalOpenAnimationLength * _animationDuration) / _previewLongPressTimeout.inMilliseconds) - totalOpenAnimationLength;
// The timing on the animation was eyeballed from the XCode iOS simulator
// running iOS 16.0.
// Because the animation no longer goes from 0.0 to 1.0, but to a number
// depending on the ratio between the press animation time and the opening
// animation time, a pause needs to be added to the end of the tween
// sequence that completes that ratio. This is to allow the animation to
// fully complete as expected without doing crazy math to the _kOpenScale
// value. This change was necessary from the inclusion of the builder and
// the complete animation value that it passes along.
_rect = TweenSequence<Rect?>(<TweenSequenceItem<Rect?>>[
TweenSequenceItem<Rect?>(
tween: RectTween(
begin: widget.beginRect,
end: widget.beginRect,
).chain(CurveTween(curve: Curves.linear)),
weight: beginPause,
),
TweenSequenceItem<Rect?>(
tween: RectTween(
begin: widget.beginRect,
end: widget.endRect,
).chain(CurveTween(curve: Curves.easeOutSine)),
weight: openAnimationLength,
),
TweenSequenceItem<Rect?>(
tween: RectTween(
begin: widget.endRect,
end: widget.endRect,
).chain(CurveTween(curve: Curves.linear)),
weight: endPause,
),
]).animate(widget.controller);
_boxDecoration = DecorationTween(
begin: const BoxDecoration(
boxShadow: <BoxShadow>[],
),
end: const BoxDecoration(
boxShadow: _endBoxShadow,
),
).animate(CurvedAnimation(
parent: widget.controller,
curve: Interval(0.0, CupertinoContextMenu.animationOpensAt),
),
);
}
Widget _buildAnimation(BuildContext context, Widget? child) {
return Positioned.fromRect(
rect: _rect.value!,
child: Container(
decoration: _boxDecoration.value,
child: widget.child,
),
);
}
Widget _buildBuilder(BuildContext context, Widget? child) {
return Positioned.fromRect(
rect: _rect.value!,
child: widget.builder!(context, widget.controller),
);
}
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
AnimatedBuilder(
builder: widget.child != null ? _buildAnimation : _buildBuilder,
animation: widget.controller,
),
],
);
}
}
// The open CupertinoContextMenu modal.
class _ContextMenuRoute<T> extends PopupRoute<T> {
// Build a _ContextMenuRoute.
_ContextMenuRoute({
required List<Widget> actions,
required _ContextMenuLocation contextMenuLocation,
this.barrierLabel,
CupertinoContextMenuBuilder? builder,
super.filter,
required Rect previousChildRect,
super.settings,
}) : assert(actions.isNotEmpty),
_actions = actions,
_builder = builder,
_contextMenuLocation = contextMenuLocation,
_previousChildRect = previousChildRect;
// Barrier color for a Cupertino modal barrier.
static const Color _kModalBarrierColor = Color(0x6604040F);
final List<Widget> _actions;
final CupertinoContextMenuBuilder? _builder;
final GlobalKey _childGlobalKey = GlobalKey();
final _ContextMenuLocation _contextMenuLocation;
bool _externalOffstage = false;
bool _internalOffstage = false;
Orientation? _lastOrientation;
// The Rect of the child at the moment that the CupertinoContextMenu opens.
final Rect _previousChildRect;
double? _scale = 1.0;
final GlobalKey _sheetGlobalKey = GlobalKey();
static final CurveTween _curve = CurveTween(
curve: Curves.easeOutBack,
);
static final CurveTween _curveReverse = CurveTween(
curve: Curves.easeInBack,
);
static final RectTween _rectTween = RectTween();
static final Animatable<Rect?> _rectAnimatable = _rectTween.chain(_curve);
static final RectTween _rectTweenReverse = RectTween();
static final Animatable<Rect?> _rectAnimatableReverse = _rectTweenReverse
.chain(
_curveReverse,
);
static final RectTween _sheetRectTween = RectTween();
final Animatable<Rect?> _sheetRectAnimatable = _sheetRectTween.chain(
_curve,
);
final Animatable<Rect?> _sheetRectAnimatableReverse = _sheetRectTween.chain(
_curveReverse,
);
static final Tween<double> _sheetScaleTween = Tween<double>();
static final Animatable<double> _sheetScaleAnimatable = _sheetScaleTween
.chain(
_curve,
);
static final Animatable<double> _sheetScaleAnimatableReverse =
_sheetScaleTween.chain(
_curveReverse,
);
final Tween<double> _opacityTween = Tween<double>(begin: 0.0, end: 1.0);
late Animation<double> _sheetOpacity;
@override
final String? barrierLabel;
@override
Color get barrierColor => _kModalBarrierColor;
@override
bool get barrierDismissible => true;
@override
bool get semanticsDismissible => false;
@override
Duration get transitionDuration => _kModalPopupTransitionDuration;
// Getting the RenderBox doesn't include the scale from the Transform.scale,
// so it's manually accounted for here.
static Rect _getScaledRect(GlobalKey globalKey, double scale) {
final Rect childRect = _getRect(globalKey);
final Size sizeScaled = childRect.size * scale;
final Offset offsetScaled = Offset(
childRect.left + (childRect.size.width - sizeScaled.width) / 2,
childRect.top + (childRect.size.height - sizeScaled.height) / 2,
);
return offsetScaled & sizeScaled;
}
// Get the alignment for the _ContextMenuSheet's Transform.scale based on the
// contextMenuLocation.
static AlignmentDirectional getSheetAlignment(_ContextMenuLocation contextMenuLocation) {
return switch (contextMenuLocation) {
_ContextMenuLocation.center => AlignmentDirectional.topCenter,
_ContextMenuLocation.right => AlignmentDirectional.topEnd,
_ContextMenuLocation.left => AlignmentDirectional.topStart,
};
}
// The place to start the sheetRect animation from.
static Rect _getSheetRectBegin(Orientation? orientation, _ContextMenuLocation contextMenuLocation, Rect childRect, Rect sheetRect) {
switch (contextMenuLocation) {
case _ContextMenuLocation.center:
final Offset target = orientation == Orientation.portrait
? childRect.bottomCenter
: childRect.topCenter;
final Offset centered = target - Offset(sheetRect.width / 2, 0.0);
return centered & sheetRect.size;
case _ContextMenuLocation.right:
final Offset target = orientation == Orientation.portrait
? childRect.bottomRight
: childRect.topRight;
return (target - Offset(sheetRect.width, 0.0)) & sheetRect.size;
case _ContextMenuLocation.left:
final Offset target = orientation == Orientation.portrait
? childRect.bottomLeft
: childRect.topLeft;
return target & sheetRect.size;
}
}
void _onDismiss(BuildContext context, double scale, double opacity) {
_scale = scale;
_opacityTween.end = opacity;
_sheetOpacity = _opacityTween.animate(CurvedAnimation(
parent: animation!,
curve: const Interval(0.9, 1.0),
));
Navigator.of(context).pop();
}
// Take measurements on the child and _ContextMenuSheet and update the
// animation tweens to match.
void _updateTweenRects() {
final Rect childRect = _scale == null
? _getRect(_childGlobalKey)
: _getScaledRect(_childGlobalKey, _scale!);
_rectTween.begin = _previousChildRect;
_rectTween.end = childRect;
// When opening, the transition happens from the end of the child's bounce
// animation to the final state. When closing, it goes from the final state
// to the original position before the bounce.
final Rect childRectOriginal = Rect.fromCenter(
center: _previousChildRect.center,
width: _previousChildRect.width / _kOpenScale,
height: _previousChildRect.height / _kOpenScale,
);
final Rect sheetRect = _getRect(_sheetGlobalKey);
final Rect sheetRectBegin = _getSheetRectBegin(
_lastOrientation,
_contextMenuLocation,
childRectOriginal,
sheetRect,
);
_sheetRectTween.begin = sheetRectBegin;
_sheetRectTween.end = sheetRect;
_sheetScaleTween.begin = 0.0;
_sheetScaleTween.end = _scale;
_rectTweenReverse.begin = childRectOriginal;
_rectTweenReverse.end = childRect;
}
void _setOffstageInternally() {
super.offstage = _externalOffstage || _internalOffstage;
// It's necessary to call changedInternalState to get the backdrop to
// update.
changedInternalState();
}
@override
bool didPop(T? result) {
_updateTweenRects();
return super.didPop(result);
}
@override
set offstage(bool value) {
_externalOffstage = value;
_setOffstageInternally();
}
@override
TickerFuture didPush() {
_internalOffstage = true;
_setOffstageInternally();
// Render one frame offstage in the final position so that we can take
// measurements of its layout and then animate to them.
SchedulerBinding.instance.addPostFrameCallback((Duration _) {
_updateTweenRects();
_internalOffstage = false;
_setOffstageInternally();
}, debugLabel: 'renderContextMenuRouteOffstage');
return super.didPush();
}
@override
Animation<double> createAnimation() {
final Animation<double> animation = super.createAnimation();
_sheetOpacity = _opacityTween.animate(CurvedAnimation(
parent: animation,
curve: Curves.linear,
));
return animation;
}
@override
Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
// This is usually used to build the "page", which is then passed to
// buildTransitions as child, the idea being that buildTransitions will
// animate the entire page into the scene. In the case of _ContextMenuRoute,
// two individual pieces of the page are animated into the scene in
// buildTransitions, and a SizedBox.shrink() is returned here.
return const SizedBox.shrink();
}
@override
Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
return OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
_lastOrientation = orientation;
// While the animation is running, render everything in a Stack so that
// they're movable.
if (!animation.isCompleted) {
final bool reverse = animation.status == AnimationStatus.reverse;
final Rect rect = reverse
? _rectAnimatableReverse.evaluate(animation)!
: _rectAnimatable.evaluate(animation)!;
final Rect sheetRect = reverse
? _sheetRectAnimatableReverse.evaluate(animation)!
: _sheetRectAnimatable.evaluate(animation)!;
final double sheetScale = reverse
? _sheetScaleAnimatableReverse.evaluate(animation)
: _sheetScaleAnimatable.evaluate(animation);
return Stack(
children: <Widget>[
Positioned.fromRect(
rect: sheetRect,
child: FadeTransition(
opacity: _sheetOpacity,
child: Transform.scale(
alignment: getSheetAlignment(_contextMenuLocation),
scale: sheetScale,
child: _ContextMenuSheet(
key: _sheetGlobalKey,
actions: _actions,
contextMenuLocation: _contextMenuLocation,
orientation: orientation,
),
),
),
),
Positioned.fromRect(
key: _childGlobalKey,
rect: rect,
child: _builder!(context, animation),
),
],
);
}
// When the animation is done, just render everything in a static layout
// in the final position.
return _ContextMenuRouteStatic(
actions: _actions,
childGlobalKey: _childGlobalKey,
contextMenuLocation: _contextMenuLocation,
onDismiss: _onDismiss,
orientation: orientation,
sheetGlobalKey: _sheetGlobalKey,
child: _builder!(context, animation),
);
},
);
}
}
// The final state of the _ContextMenuRoute after animating in and before
// animating out.
class _ContextMenuRouteStatic extends StatefulWidget {
const _ContextMenuRouteStatic({
this.actions,
required this.child,
this.childGlobalKey,
required this.contextMenuLocation,
this.onDismiss,
required this.orientation,
this.sheetGlobalKey,
});
final List<Widget>? actions;
final Widget child;
final GlobalKey? childGlobalKey;
final _ContextMenuLocation contextMenuLocation;
final _DismissCallback? onDismiss;
final Orientation orientation;
final GlobalKey? sheetGlobalKey;
@override
_ContextMenuRouteStaticState createState() => _ContextMenuRouteStaticState();
}
class _ContextMenuRouteStaticState extends State<_ContextMenuRouteStatic> with TickerProviderStateMixin {
// The child is scaled down as it is dragged down until it hits this minimum
// value.
static const double _kMinScale = 0.8;
// The CupertinoContextMenuSheet disappears at this scale.
static const double _kSheetScaleThreshold = 0.9;
static const double _kPadding = 20.0;
static const double _kDamping = 400.0;
static const Duration _kMoveControllerDuration = Duration(milliseconds: 600);
late Offset _dragOffset;
double _lastScale = 1.0;
late AnimationController _moveController;
late AnimationController _sheetController;
late Animation<Offset> _moveAnimation;
late Animation<double> _sheetScaleAnimation;
late Animation<double> _sheetOpacityAnimation;
// The scale of the child changes as a function of the distance it is dragged.
static double _getScale(Orientation orientation, double maxDragDistance, double dy) {
final double dyDirectional = dy <= 0.0 ? dy : -dy;
return math.max(
_kMinScale,
(maxDragDistance + dyDirectional) / maxDragDistance,
);
}
void _onPanStart(DragStartDetails details) {
_moveController.value = 1.0;
_setDragOffset(Offset.zero);
}
void _onPanUpdate(DragUpdateDetails details) {
_setDragOffset(_dragOffset + details.delta);
}
void _onPanEnd(DragEndDetails details) {
// If flung, animate a bit before handling the potential dismiss.
if (details.velocity.pixelsPerSecond.dy.abs() >= kMinFlingVelocity) {
final bool flingIsAway = details.velocity.pixelsPerSecond.dy > 0;
final double finalPosition = flingIsAway
? _moveAnimation.value.dy + 100.0
: 0.0;
if (flingIsAway && _sheetController.status != AnimationStatus.forward) {
_sheetController.forward();
} else if (!flingIsAway && _sheetController.status != AnimationStatus.reverse) {
_sheetController.reverse();
}
_moveAnimation = Tween<Offset>(
begin: Offset(0.0, _moveAnimation.value.dy),
end: Offset(0.0, finalPosition),
).animate(_moveController);
_moveController.reset();
_moveController.duration = const Duration(
milliseconds: 64,
);
_moveController.forward();
_moveController.addStatusListener(_flingStatusListener);
return;
}
// Dismiss if the drag is enough to scale down all the way.
if (_lastScale == _kMinScale) {
widget.onDismiss!(context, _lastScale, _sheetOpacityAnimation.value);
return;
}
// Otherwise animate back home.
_moveController.addListener(_moveListener);
_moveController.reverse();
}
void _moveListener() {
// When the scale passes the threshold, animate the sheet back in.
if (_lastScale > _kSheetScaleThreshold) {
_moveController.removeListener(_moveListener);
if (_sheetController.status != AnimationStatus.dismissed) {
_sheetController.reverse();
}
}
}
void _flingStatusListener(AnimationStatus status) {
if (status != AnimationStatus.completed) {
return;
}
// Reset the duration back to its original value.
_moveController.duration = _kMoveControllerDuration;
_moveController.removeStatusListener(_flingStatusListener);
// If it was a fling back to the start, it has reset itself, and it should
// not be dismissed.
if (_moveAnimation.value.dy == 0.0) {
return;
}
widget.onDismiss!(context, _lastScale, _sheetOpacityAnimation.value);
}
Alignment _getChildAlignment(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
if (orientation == Orientation.portrait) {
return Alignment.bottomCenter;
}
return switch (contextMenuLocation) {
_ContextMenuLocation.left => Alignment.topRight,
_ContextMenuLocation.center => Alignment.topRight,
_ContextMenuLocation.right => Alignment.topLeft,
};
}
void _setDragOffset(Offset dragOffset) {
// Allow horizontal and negative vertical movement, but damp it.
final double endX = _kPadding * dragOffset.dx / _kDamping;
final double endY = dragOffset.dy >= 0.0
? dragOffset.dy
: _kPadding * dragOffset.dy / _kDamping;
setState(() {
_dragOffset = dragOffset;
_moveAnimation = Tween<Offset>(
begin: Offset.zero,
end: Offset(
clampDouble(endX, -_kPadding, _kPadding),
endY,
),
).animate(
CurvedAnimation(
parent: _moveController,
curve: Curves.elasticIn,
),
);
// Fade the _ContextMenuSheet out or in, if needed.
if (_lastScale <= _kSheetScaleThreshold
&& _sheetController.status != AnimationStatus.forward
&& _sheetScaleAnimation.value != 0.0) {
_sheetController.forward();
} else if (_lastScale > _kSheetScaleThreshold
&& _sheetController.status != AnimationStatus.reverse
&& _sheetScaleAnimation.value != 1.0) {
_sheetController.reverse();
}
});
}
// The order and alignment of the _ContextMenuSheet and the child depend on
// both the orientation of the screen as well as the position on the screen of
// the original child.
List<Widget> _getChildren(Orientation orientation, _ContextMenuLocation contextMenuLocation) {
final Expanded child = Expanded(
child: Align(
alignment: _getChildAlignment(
widget.orientation,
widget.contextMenuLocation,
),
child: AnimatedBuilder(
animation: _moveController,
builder: _buildChildAnimation,
child: widget.child,
),
),
);
const SizedBox spacer = SizedBox(
width: _kPadding,
height: _kPadding,
);
final Expanded sheet = Expanded(
child: AnimatedBuilder(
animation: _sheetController,
builder: _buildSheetAnimation,
child: _ContextMenuSheet(
key: widget.sheetGlobalKey,
actions: widget.actions!,
contextMenuLocation: widget.contextMenuLocation,
orientation: widget.orientation,
),
),
);
return switch (contextMenuLocation) {
_ContextMenuLocation.right when orientation == Orientation.portrait => <Widget>[child, spacer, sheet],
_ContextMenuLocation.right => <Widget>[sheet, spacer, child],
_ContextMenuLocation.center => <Widget>[child, spacer, sheet],
_ContextMenuLocation.left => <Widget>[child, spacer, sheet],
};
}
// Build the animation for the _ContextMenuSheet.
Widget _buildSheetAnimation(BuildContext context, Widget? child) {
return Transform.scale(
alignment: _ContextMenuRoute.getSheetAlignment(widget.contextMenuLocation),
scale: _sheetScaleAnimation.value,
child: FadeTransition(
opacity: _sheetOpacityAnimation,
child: child,
),
);
}
// Build the animation for the child.
Widget _buildChildAnimation(BuildContext context, Widget? child) {
_lastScale = _getScale(
widget.orientation,
MediaQuery.sizeOf(context).height,
_moveAnimation.value.dy,
);
return Transform.scale(
key: widget.childGlobalKey,
scale: _lastScale,
child: child,
);
}
// Build the animation for the overall draggable dismissible content.
Widget _buildAnimation(BuildContext context, Widget? child) {
return Transform.translate(
offset: _moveAnimation.value,
child: child,
);
}
@override
void initState() {
super.initState();
_moveController = AnimationController(
duration: _kMoveControllerDuration,
value: 1.0,
vsync: this,
);
_sheetController = AnimationController(
duration: const Duration(milliseconds: 100),
reverseDuration: const Duration(milliseconds: 300),
vsync: this,
);
_sheetScaleAnimation = Tween<double>(
begin: 1.0,
end: 0.0,
).animate(
CurvedAnimation(
parent: _sheetController,
curve: Curves.linear,
reverseCurve: Curves.easeInBack,
),
);
_sheetOpacityAnimation = Tween<double>(
begin: 1.0,
end: 0.0,
).animate(_sheetController);
_setDragOffset(Offset.zero);
}
@override
void dispose() {
_moveController.dispose();
_sheetController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final List<Widget> children = _getChildren(
widget.orientation,
widget.contextMenuLocation,
);
return SafeArea(
child: Align(
alignment: Alignment.topLeft,
child: GestureDetector(
onPanEnd: _onPanEnd,
onPanStart: _onPanStart,
onPanUpdate: _onPanUpdate,
child: AnimatedBuilder(
animation: _moveController,
builder: _buildAnimation,
child: widget.orientation == Orientation.portrait
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
)
: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
),
),
),
),
);
}
}
// The menu that displays when CupertinoContextMenu is open. It consists of a
// list of actions that are typically CupertinoContextMenuActions.
class _ContextMenuSheet extends StatelessWidget {
_ContextMenuSheet({
super.key,
required this.actions,
required _ContextMenuLocation contextMenuLocation,
required Orientation orientation,
}) : assert(actions.isNotEmpty),
_contextMenuLocation = contextMenuLocation,
_orientation = orientation;
final List<Widget> actions;
final _ContextMenuLocation _contextMenuLocation;
final Orientation _orientation;
static const double _kMenuWidth = 250.0;
// Get the children, whose order depends on orientation and
// contextMenuLocation.
List<Widget> getChildren(BuildContext context) {
final Widget menu = SizedBox(
width: _kMenuWidth,
child: IntrinsicHeight(
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(13.0)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
actions.first,
for (final Widget action in actions.skip(1))
DecoratedBox(
decoration: BoxDecoration(
border: Border(
top: BorderSide(
color: CupertinoDynamicColor.resolve(
_borderColor,
context,
),
width: 0.4,
),
),
),
position: DecorationPosition.foreground,
child: action,
),
],
),
),
),
);
return switch (_contextMenuLocation) {
_ContextMenuLocation.center when _orientation == Orientation.portrait => <Widget>[const Spacer(), menu, const Spacer()],
_ContextMenuLocation.center => <Widget>[menu, const Spacer()],
_ContextMenuLocation.right => <Widget>[const Spacer(), menu],
_ContextMenuLocation.left => <Widget>[menu, const Spacer()],
};
}
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: getChildren(context),
);
}
}
| flutter/packages/flutter/lib/src/cupertino/context_menu.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/cupertino/context_menu.dart",
"repo_id": "flutter",
"token_count": 17351
} | 788 |
// 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 'dart:math' as math;
import 'package:flutter/widgets.dart';
/// A [CupertinoMagnifier] used for magnifying text in cases where a user's
/// finger may be blocking the point of interest, like a selection handle.
///
/// Delegates styling to [CupertinoMagnifier] with its position depending on
/// [magnifierInfo].
///
/// Specifically, the [CupertinoTextMagnifier] follows the following rules.
/// [CupertinoTextMagnifier]:
/// - is positioned horizontally inside the screen width, with [horizontalScreenEdgePadding] padding.
/// - is hidden if a gesture is detected [hideBelowThreshold] units below the line
/// that the magnifier is on, shown otherwise.
/// - follows the x coordinate of the gesture directly (with respect to rule 1).
/// - has some vertical drag resistance; i.e. if a gesture is detected k units below the field,
/// then has vertical offset [dragResistance] * k.
class CupertinoTextMagnifier extends StatefulWidget {
/// Constructs a [RawMagnifier] in the Cupertino style, positioning with respect to
/// [magnifierInfo].
///
/// The default constructor parameters and constants were eyeballed on
/// an iPhone XR iOS v15.5.
const CupertinoTextMagnifier({
super.key,
this.animationCurve = Curves.easeOut,
required this.controller,
this.dragResistance = 10.0,
this.hideBelowThreshold = 48.0,
this.horizontalScreenEdgePadding = 10.0,
required this.magnifierInfo,
});
/// The curve used for the in / out animations.
final Curve animationCurve;
/// This magnifier's controller.
///
/// The [CupertinoTextMagnifier] requires a [MagnifierController]
/// in order to show / hide itself without removing itself from the
/// overlay.
final MagnifierController controller;
/// A drag resistance on the downward Y position of the lens.
final double dragResistance;
/// The difference in Y between the gesture position and the caret center
/// so that the magnifier hides itself.
final double hideBelowThreshold;
/// The padding on either edge of the screen that any part of the magnifier
/// cannot exist past.
///
/// This includes any part of the magnifier, not just the center; for example,
/// the left edge of the magnifier cannot be outside the [horizontalScreenEdgePadding].v
///
/// If the screen has width w, then the magnifier is bound to
/// `_kHorizontalScreenEdgePadding, w - _kHorizontalScreenEdgePadding`.
final double horizontalScreenEdgePadding;
/// [CupertinoTextMagnifier] will determine its own positioning
/// based on the [MagnifierInfo] of this notifier.
final ValueNotifier<MagnifierInfo>
magnifierInfo;
/// The duration that the magnifier drags behind its final position.
static const Duration _kDragAnimationDuration = Duration(milliseconds: 45);
@override
State<CupertinoTextMagnifier> createState() =>
_CupertinoTextMagnifierState();
}
class _CupertinoTextMagnifierState extends State<CupertinoTextMagnifier>
with SingleTickerProviderStateMixin {
// Initialize to dummy values for the event that the initial call to
// _determineMagnifierPositionAndFocalPoint calls hide, and thus does not
// set these values.
Offset _currentAdjustedMagnifierPosition = Offset.zero;
double _verticalFocalPointAdjustment = 0;
late AnimationController _ioAnimationController;
late Animation<double> _ioAnimation;
@override
void initState() {
super.initState();
_ioAnimationController = AnimationController(
value: 0,
vsync: this,
duration: CupertinoMagnifier._kInOutAnimationDuration,
)..addListener(() => setState(() {}));
widget.controller.animationController = _ioAnimationController;
widget.magnifierInfo
.addListener(_determineMagnifierPositionAndFocalPoint);
_ioAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: _ioAnimationController,
curve: widget.animationCurve,
));
}
@override
void dispose() {
widget.controller.animationController = null;
_ioAnimationController.dispose();
widget.magnifierInfo
.removeListener(_determineMagnifierPositionAndFocalPoint);
super.dispose();
}
@override
void didUpdateWidget(CupertinoTextMagnifier oldWidget) {
if (oldWidget.magnifierInfo != widget.magnifierInfo) {
oldWidget.magnifierInfo.removeListener(_determineMagnifierPositionAndFocalPoint);
widget.magnifierInfo.addListener(_determineMagnifierPositionAndFocalPoint);
}
super.didUpdateWidget(oldWidget);
}
@override
void didChangeDependencies() {
_determineMagnifierPositionAndFocalPoint();
super.didChangeDependencies();
}
void _determineMagnifierPositionAndFocalPoint() {
final MagnifierInfo textEditingContext =
widget.magnifierInfo.value;
// The exact Y of the center of the current line.
final double verticalCenterOfCurrentLine =
textEditingContext.caretRect.center.dy;
// If the magnifier is currently showing, but we have dragged out of threshold,
// we should hide it.
if (verticalCenterOfCurrentLine -
textEditingContext.globalGesturePosition.dy <
-widget.hideBelowThreshold) {
// Only signal a hide if we are currently showing.
if (widget.controller.shown) {
widget.controller.hide(removeFromOverlay: false);
}
return;
}
// If we are gone, but got to this point, we shouldn't be: show.
if (!widget.controller.shown) {
_ioAnimationController.forward();
}
// Never go above the center of the line, but have some resistance
// going downward if the drag goes too far.
final double verticalPositionOfLens = math.max(
verticalCenterOfCurrentLine,
verticalCenterOfCurrentLine -
(verticalCenterOfCurrentLine -
textEditingContext.globalGesturePosition.dy) /
widget.dragResistance);
// The raw position, tracking the gesture directly.
final Offset rawMagnifierPosition = Offset(
textEditingContext.globalGesturePosition.dx -
CupertinoMagnifier.kDefaultSize.width / 2,
verticalPositionOfLens -
(CupertinoMagnifier.kDefaultSize.height -
CupertinoMagnifier.kMagnifierAboveFocalPoint),
);
final Rect screenRect = Offset.zero & MediaQuery.sizeOf(context);
// Adjust the magnifier position so that it never exists outside the horizontal
// padding.
final Offset adjustedMagnifierPosition = MagnifierController.shiftWithinBounds(
bounds: Rect.fromLTRB(
screenRect.left + widget.horizontalScreenEdgePadding,
// iOS doesn't reposition for Y, so we should expand the threshold
// so we can send the whole magnifier out of bounds if need be.
screenRect.top -
(CupertinoMagnifier.kDefaultSize.height +
CupertinoMagnifier.kMagnifierAboveFocalPoint),
screenRect.right - widget.horizontalScreenEdgePadding,
screenRect.bottom +
(CupertinoMagnifier.kDefaultSize.height +
CupertinoMagnifier.kMagnifierAboveFocalPoint)),
rect: rawMagnifierPosition & CupertinoMagnifier.kDefaultSize,
).topLeft;
setState(() {
_currentAdjustedMagnifierPosition = adjustedMagnifierPosition;
// The lens should always point to the center of the line.
_verticalFocalPointAdjustment =
verticalCenterOfCurrentLine - verticalPositionOfLens;
});
}
@override
Widget build(BuildContext context) {
return AnimatedPositioned(
duration: CupertinoTextMagnifier._kDragAnimationDuration,
curve: widget.animationCurve,
left: _currentAdjustedMagnifierPosition.dx,
top: _currentAdjustedMagnifierPosition.dy,
child: CupertinoMagnifier(
inOutAnimation: _ioAnimation,
additionalFocalPointOffset: Offset(0, _verticalFocalPointAdjustment),
),
);
}
}
/// A [RawMagnifier] used for magnifying text in cases where a user's
/// finger may be blocking the point of interest, like a selection handle.
///
/// [CupertinoMagnifier] is a wrapper around [RawMagnifier] that handles styling
/// and transitions.
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// See also:
///
/// * [RawMagnifier], the backing implementation.
/// * [CupertinoTextMagnifier], a widget that positions [CupertinoMagnifier] based on
/// [MagnifierInfo].
/// * [MagnifierController], the controller for this magnifier.
class CupertinoMagnifier extends StatelessWidget {
/// Creates a [RawMagnifier] in the Cupertino style.
///
/// The default constructor parameters and constants were eyeballed on
/// an iPhone XR iOS v15.5.
const CupertinoMagnifier({
super.key,
this.size = kDefaultSize,
this.borderRadius = const BorderRadius.all(Radius.elliptical(60, 50)),
this.additionalFocalPointOffset = Offset.zero,
this.shadows = const <BoxShadow>[
BoxShadow(
color: Color.fromARGB(25, 0, 0, 0),
blurRadius: 11,
spreadRadius: 0.2,
),
],
this.borderSide =
const BorderSide(color: Color.fromARGB(255, 232, 232, 232)),
this.inOutAnimation,
});
/// The shadows displayed under the magnifier.
final List<BoxShadow> shadows;
/// The border, or "rim", of this magnifier.
final BorderSide borderSide;
/// The vertical offset that the magnifier is along the Y axis above
/// the focal point.
@visibleForTesting
static const double kMagnifierAboveFocalPoint = -26;
/// The default size of the magnifier.
///
/// This is public so that positioners can choose to depend on it, although
/// it is overridable.
@visibleForTesting
static const Size kDefaultSize = Size(80, 47.5);
/// The duration that this magnifier animates in / out for.
///
/// The animation is a translation and a fade. The translation
/// begins at the focal point, and ends at [kMagnifierAboveFocalPoint].
/// The opacity begins at 0 and ends at 1.
static const Duration _kInOutAnimationDuration = Duration(milliseconds: 150);
/// The size of this magnifier.
final Size size;
/// The border radius of this magnifier.
final BorderRadius borderRadius;
/// This [RawMagnifier]'s controller.
///
/// Since [CupertinoMagnifier] has no knowledge of shown / hidden state,
/// this animation should be driven by an external actor.
final Animation<double>? inOutAnimation;
/// Any additional focal point offset, applied over the regular focal
/// point offset defined in [kMagnifierAboveFocalPoint].
final Offset additionalFocalPointOffset;
@override
Widget build(BuildContext context) {
Offset focalPointOffset =
Offset(0, (kDefaultSize.height / 2) - kMagnifierAboveFocalPoint);
focalPointOffset.scale(1, inOutAnimation?.value ?? 1);
focalPointOffset += additionalFocalPointOffset;
return Transform.translate(
offset: Offset.lerp(
const Offset(0, -kMagnifierAboveFocalPoint),
Offset.zero,
inOutAnimation?.value ?? 1,
)!,
child: RawMagnifier(
size: size,
focalPointOffset: focalPointOffset,
decoration: MagnifierDecoration(
opacity: inOutAnimation?.value ?? 1,
shape: RoundedRectangleBorder(
borderRadius: borderRadius,
side: borderSide,
),
shadows: shadows,
),
),
);
}
}
| flutter/packages/flutter/lib/src/cupertino/magnifier.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/cupertino/magnifier.dart",
"repo_id": "flutter",
"token_count": 3834
} | 789 |
// 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 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle;
import 'package:flutter/foundation.dart' show defaultTargetPlatform;
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'adaptive_text_selection_toolbar.dart';
import 'colors.dart';
import 'desktop_text_selection.dart';
import 'icons.dart';
import 'localizations.dart';
import 'magnifier.dart';
import 'spell_check_suggestions_toolbar.dart';
import 'text_selection.dart';
import 'theme.dart';
export 'package:flutter/services.dart' show SmartDashesType, SmartQuotesType, TextCapitalization, TextInputAction, TextInputType;
const TextStyle _kDefaultPlaceholderStyle = TextStyle(
fontWeight: FontWeight.w400,
color: CupertinoColors.placeholderText,
);
// Value inspected from Xcode 11 & iOS 13.0 Simulator.
const BorderSide _kDefaultRoundedBorderSide = BorderSide(
color: CupertinoDynamicColor.withBrightness(
color: Color(0x33000000),
darkColor: Color(0x33FFFFFF),
),
width: 0.0,
);
const Border _kDefaultRoundedBorder = Border(
top: _kDefaultRoundedBorderSide,
bottom: _kDefaultRoundedBorderSide,
left: _kDefaultRoundedBorderSide,
right: _kDefaultRoundedBorderSide,
);
const BoxDecoration _kDefaultRoundedBorderDecoration = BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: CupertinoColors.white,
darkColor: CupertinoColors.black,
),
border: _kDefaultRoundedBorder,
borderRadius: BorderRadius.all(Radius.circular(5.0)),
);
const Color _kDisabledBackground = CupertinoDynamicColor.withBrightness(
color: Color(0xFFFAFAFA),
darkColor: Color(0xFF050505),
);
// Value inspected from Xcode 12 & iOS 14.0 Simulator.
// Note it may not be consistent with https://developer.apple.com/design/resources/.
const CupertinoDynamicColor _kClearButtonColor = CupertinoDynamicColor.withBrightness(
color: Color(0x33000000),
darkColor: Color(0x33FFFFFF),
);
// An eyeballed value that moves the cursor slightly left of where it is
// rendered for text on Android so it's positioning more accurately matches the
// native iOS text cursor positioning.
//
// This value is in device pixels, not logical pixels as is typically used
// throughout the codebase.
const int _iOSHorizontalCursorOffsetPixels = -2;
/// Visibility of text field overlays based on the state of the current text entry.
///
/// Used to toggle the visibility behavior of the optional decorating widgets
/// surrounding the [EditableText] such as the clear text button.
enum OverlayVisibilityMode {
/// Overlay will never appear regardless of the text entry state.
never,
/// Overlay will only appear when the current text entry is not empty.
///
/// This includes prefilled text that the user did not type in manually. But
/// does not include text in placeholders.
editing,
/// Overlay will only appear when the current text entry is empty.
///
/// This also includes not having prefilled text that the user did not type
/// in manually. Texts in placeholders are ignored.
notEditing,
/// Always show the overlay regardless of the text entry state.
always,
}
class _CupertinoTextFieldSelectionGestureDetectorBuilder extends TextSelectionGestureDetectorBuilder {
_CupertinoTextFieldSelectionGestureDetectorBuilder({
required _CupertinoTextFieldState state,
}) : _state = state,
super(delegate: state);
final _CupertinoTextFieldState _state;
@override
void onSingleTapUp(TapDragUpDetails details) {
// Because TextSelectionGestureDetector listens to taps that happen on
// widgets in front of it, tapping the clear button will also trigger
// this handler. If the clear button widget recognizes the up event,
// then do not handle it.
if (_state._clearGlobalKey.currentContext != null) {
final RenderBox renderBox = _state._clearGlobalKey.currentContext!.findRenderObject()! as RenderBox;
final Offset localOffset = renderBox.globalToLocal(details.globalPosition);
if (renderBox.hitTest(BoxHitTestResult(), position: localOffset)) {
return;
}
}
super.onSingleTapUp(details);
_state.widget.onTap?.call();
}
@override
void onDragSelectionEnd(TapDragEndDetails details) {
_state._requestKeyboard();
super.onDragSelectionEnd(details);
}
}
/// An iOS-style text field.
///
/// A text field lets the user enter text, either with a hardware keyboard or with
/// an onscreen keyboard.
///
/// This widget corresponds to both a `UITextField` and an editable `UITextView`
/// on iOS.
///
/// The text field calls the [onChanged] callback whenever the user changes the
/// text in the field. If the user indicates that they are done typing in the
/// field (e.g., by pressing a button on the soft keyboard), the text field
/// calls the [onSubmitted] callback.
///
/// {@macro flutter.widgets.EditableText.onChanged}
///
/// {@tool dartpad}
/// This example shows how to set the initial value of the [CupertinoTextField] using
/// a [controller] that already contains some text.
///
/// ** See code in examples/api/lib/cupertino/text_field/cupertino_text_field.0.dart **
/// {@end-tool}
///
/// The [controller] can also control the selection and composing region (and to
/// observe changes to the text, selection, and composing region).
///
/// The text field has an overridable [decoration] that, by default, draws a
/// rounded rectangle border around the text field. If you set the [decoration]
/// property to null, the decoration will be removed entirely.
///
/// {@macro flutter.material.textfield.wantKeepAlive}
///
/// Remember to call [TextEditingController.dispose] when it is no longer
/// needed. This will ensure we discard any resources used by the object.
///
/// {@macro flutter.widgets.editableText.showCaretOnScreen}
///
/// ## Scrolling Considerations
///
/// If this [CupertinoTextField] is not a descendant of [Scaffold] and is being
/// used within a [Scrollable] or nested [Scrollable]s, consider placing a
/// [ScrollNotificationObserver] above the root [Scrollable] that contains this
/// [CupertinoTextField] to ensure proper scroll coordination for
/// [CupertinoTextField] and its components like [TextSelectionOverlay].
///
/// See also:
///
/// * <https://developer.apple.com/documentation/uikit/uitextfield>
/// * [TextField], an alternative text field widget that follows the Material
/// Design UI conventions.
/// * [EditableText], which is the raw text editing control at the heart of a
/// [TextField].
/// * Learn how to use a [TextEditingController] in one of our [cookbook recipes](https://flutter.dev/docs/cookbook/forms/text-field-changes#2-use-a-texteditingcontroller).
/// * <https://developer.apple.com/design/human-interface-guidelines/ios/controls/text-fields/>
class CupertinoTextField extends StatefulWidget {
/// Creates an iOS-style text field.
///
/// To provide a prefilled text entry, pass in a [TextEditingController] with
/// an initial value to the [controller] parameter.
///
/// To provide a hint placeholder text that appears when the text entry is
/// empty, pass a [String] to the [placeholder] parameter.
///
/// The [maxLines] property can be set to null to remove the restriction on
/// the number of lines. In this mode, the intrinsic height of the widget will
/// grow as the number of lines of text grows. By default, it is `1`, meaning
/// this is a single-line text field and will scroll horizontally when
/// it overflows. [maxLines] must not be zero.
///
/// The text cursor is not shown if [showCursor] is false or if [showCursor]
/// is null (the default) and [readOnly] is true.
///
/// If specified, the [maxLength] property must be greater than zero.
///
/// The [selectionHeightStyle] and [selectionWidthStyle] properties allow
/// changing the shape of the selection highlighting. These properties default
/// to [ui.BoxHeightStyle.tight] and [ui.BoxWidthStyle.tight], respectively.
///
/// The [autocorrect], [autofocus], [clearButtonMode], [dragStartBehavior],
/// [expands], [obscureText], [prefixMode], [readOnly], [scrollPadding],
/// [suffixMode], [textAlign], [selectionHeightStyle], [selectionWidthStyle],
/// [enableSuggestions], and [enableIMEPersonalizedLearning] properties must
/// not be null.
///
/// {@macro flutter.widgets.editableText.accessibility}
///
/// See also:
///
/// * [minLines], which is the minimum number of lines to occupy when the
/// content spans fewer lines.
/// * [expands], to allow the widget to size itself to its parent's height.
/// * [maxLength], which discusses the precise meaning of "number of
/// characters" and how it may differ from the intuitive meaning.
const CupertinoTextField({
super.key,
this.controller,
this.focusNode,
this.undoController,
this.decoration = _kDefaultRoundedBorderDecoration,
this.padding = const EdgeInsets.all(7.0),
this.placeholder,
this.placeholderStyle = const TextStyle(
fontWeight: FontWeight.w400,
color: CupertinoColors.placeholderText,
),
this.prefix,
this.prefixMode = OverlayVisibilityMode.always,
this.suffix,
this.suffixMode = OverlayVisibilityMode.always,
this.clearButtonMode = OverlayVisibilityMode.never,
this.clearButtonSemanticLabel,
TextInputType? keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.none,
this.style,
this.strutStyle,
this.textAlign = TextAlign.start,
this.textAlignVertical,
this.textDirection,
this.readOnly = false,
@Deprecated(
'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.',
)
this.toolbarOptions,
this.showCursor,
this.autofocus = false,
this.obscuringCharacter = '•',
this.obscureText = false,
this.autocorrect = true,
SmartDashesType? smartDashesType,
SmartQuotesType? smartQuotesType,
this.enableSuggestions = true,
this.maxLines = 1,
this.minLines,
this.expands = false,
this.maxLength,
this.maxLengthEnforcement,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.onTapOutside,
this.inputFormatters,
this.enabled = true,
this.cursorWidth = 2.0,
this.cursorHeight,
this.cursorRadius = const Radius.circular(2.0),
this.cursorOpacityAnimates = true,
this.cursorColor,
this.selectionHeightStyle = ui.BoxHeightStyle.tight,
this.selectionWidthStyle = ui.BoxWidthStyle.tight,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.dragStartBehavior = DragStartBehavior.start,
bool? enableInteractiveSelection,
this.selectionControls,
this.onTap,
this.scrollController,
this.scrollPhysics,
this.autofillHints = const <String>[],
this.contentInsertionConfiguration,
this.clipBehavior = Clip.hardEdge,
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.spellCheckConfiguration,
this.magnifierConfiguration,
}) : assert(obscuringCharacter.length == 1),
smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
assert(maxLines == null || maxLines > 0),
assert(minLines == null || minLines > 0),
assert(
(maxLines == null) || (minLines == null) || (maxLines >= minLines),
"minLines can't be greater than maxLines",
),
assert(
!expands || (maxLines == null && minLines == null),
'minLines and maxLines must be null when expands is true.',
),
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
assert(maxLength == null || maxLength > 0),
// Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
assert(
!identical(textInputAction, TextInputAction.newline) ||
maxLines == 1 ||
!identical(keyboardType, TextInputType.text),
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
),
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
enableInteractiveSelection = enableInteractiveSelection ?? (!readOnly || !obscureText);
/// Creates a borderless iOS-style text field.
///
/// To provide a prefilled text entry, pass in a [TextEditingController] with
/// an initial value to the [controller] parameter.
///
/// To provide a hint placeholder text that appears when the text entry is
/// empty, pass a [String] to the [placeholder] parameter.
///
/// The [maxLines] property can be set to null to remove the restriction on
/// the number of lines. In this mode, the intrinsic height of the widget will
/// grow as the number of lines of text grows. By default, it is `1`, meaning
/// this is a single-line text field and will scroll horizontally when
/// it overflows. [maxLines] must not be zero.
///
/// The text cursor is not shown if [showCursor] is false or if [showCursor]
/// is null (the default) and [readOnly] is true.
///
/// If specified, the [maxLength] property must be greater than zero.
///
/// The [selectionHeightStyle] and [selectionWidthStyle] properties allow
/// changing the shape of the selection highlighting. These properties default
/// to [ui.BoxHeightStyle.tight] and [ui.BoxWidthStyle.tight] respectively.
///
/// See also:
///
/// * [minLines], which is the minimum number of lines to occupy when the
/// content spans fewer lines.
/// * [expands], to allow the widget to size itself to its parent's height.
/// * [maxLength], which discusses the precise meaning of "number of
/// characters" and how it may differ from the intuitive meaning.
const CupertinoTextField.borderless({
super.key,
this.controller,
this.focusNode,
this.undoController,
this.decoration,
this.padding = const EdgeInsets.all(7.0),
this.placeholder,
this.placeholderStyle = _kDefaultPlaceholderStyle,
this.prefix,
this.prefixMode = OverlayVisibilityMode.always,
this.suffix,
this.suffixMode = OverlayVisibilityMode.always,
this.clearButtonMode = OverlayVisibilityMode.never,
this.clearButtonSemanticLabel,
TextInputType? keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.none,
this.style,
this.strutStyle,
this.textAlign = TextAlign.start,
this.textAlignVertical,
this.textDirection,
this.readOnly = false,
@Deprecated(
'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.',
)
this.toolbarOptions,
this.showCursor,
this.autofocus = false,
this.obscuringCharacter = '•',
this.obscureText = false,
this.autocorrect = true,
SmartDashesType? smartDashesType,
SmartQuotesType? smartQuotesType,
this.enableSuggestions = true,
this.maxLines = 1,
this.minLines,
this.expands = false,
this.maxLength,
this.maxLengthEnforcement,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.onTapOutside,
this.inputFormatters,
this.enabled = true,
this.cursorWidth = 2.0,
this.cursorHeight,
this.cursorRadius = const Radius.circular(2.0),
this.cursorOpacityAnimates = true,
this.cursorColor,
this.selectionHeightStyle = ui.BoxHeightStyle.tight,
this.selectionWidthStyle = ui.BoxWidthStyle.tight,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.dragStartBehavior = DragStartBehavior.start,
bool? enableInteractiveSelection,
this.selectionControls,
this.onTap,
this.scrollController,
this.scrollPhysics,
this.autofillHints = const <String>[],
this.contentInsertionConfiguration,
this.clipBehavior = Clip.hardEdge,
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.spellCheckConfiguration,
this.magnifierConfiguration,
}) : assert(obscuringCharacter.length == 1),
smartDashesType = smartDashesType ?? (obscureText ? SmartDashesType.disabled : SmartDashesType.enabled),
smartQuotesType = smartQuotesType ?? (obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled),
assert(maxLines == null || maxLines > 0),
assert(minLines == null || minLines > 0),
assert(
(maxLines == null) || (minLines == null) || (maxLines >= minLines),
"minLines can't be greater than maxLines",
),
assert(
!expands || (maxLines == null && minLines == null),
'minLines and maxLines must be null when expands is true.',
),
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
assert(maxLength == null || maxLength > 0),
// Assert the following instead of setting it directly to avoid surprising the user by silently changing the value they set.
assert(
!identical(textInputAction, TextInputAction.newline) ||
maxLines == 1 ||
!identical(keyboardType, TextInputType.text),
'Use keyboardType TextInputType.multiline when using TextInputAction.newline on a multiline TextField.',
),
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
enableInteractiveSelection = enableInteractiveSelection ?? (!readOnly || !obscureText);
/// Controls the text being edited.
///
/// If null, this widget will create its own [TextEditingController].
final TextEditingController? controller;
/// {@macro flutter.widgets.Focus.focusNode}
final FocusNode? focusNode;
/// Controls the [BoxDecoration] of the box behind the text input.
///
/// Defaults to having a rounded rectangle grey border and can be null to have
/// no box decoration.
final BoxDecoration? decoration;
/// Padding around the text entry area between the [prefix] and [suffix]
/// or the clear button when [clearButtonMode] is not never.
///
/// Defaults to a padding of 6 pixels on all sides and can be null.
final EdgeInsetsGeometry padding;
/// A lighter colored placeholder hint that appears on the first line of the
/// text field when the text entry is empty.
///
/// Defaults to having no placeholder text.
///
/// The text style of the placeholder text matches that of the text field's
/// main text entry except a lighter font weight and a grey font color.
final String? placeholder;
/// The style to use for the placeholder text.
///
/// The [placeholderStyle] is merged with the [style] [TextStyle] when applied
/// to the [placeholder] text. To avoid merging with [style], specify
/// [TextStyle.inherit] as false.
///
/// Defaults to the [style] property with w300 font weight and grey color.
///
/// If specifically set to null, placeholder's style will be the same as [style].
final TextStyle? placeholderStyle;
/// An optional [Widget] to display before the text.
final Widget? prefix;
/// Controls the visibility of the [prefix] widget based on the state of
/// text entry when the [prefix] argument is not null.
///
/// Defaults to [OverlayVisibilityMode.always].
///
/// Has no effect when [prefix] is null.
final OverlayVisibilityMode prefixMode;
/// An optional [Widget] to display after the text.
final Widget? suffix;
/// Controls the visibility of the [suffix] widget based on the state of
/// text entry when the [suffix] argument is not null.
///
/// Defaults to [OverlayVisibilityMode.always].
///
/// Has no effect when [suffix] is null.
final OverlayVisibilityMode suffixMode;
/// Show an iOS-style clear button to clear the current text entry.
///
/// Can be made to appear depending on various text states of the
/// [TextEditingController].
///
/// Will only appear if no [suffix] widget is appearing.
///
/// Defaults to [OverlayVisibilityMode.never].
final OverlayVisibilityMode clearButtonMode;
/// The semantic label for the clear button used by screen readers.
///
/// This will be used by screen reading software to identify the clear button
/// widget. Defaults to "Clear".
final String? clearButtonSemanticLabel;
/// {@macro flutter.widgets.editableText.keyboardType}
final TextInputType keyboardType;
/// The type of action button to use for the keyboard.
///
/// Defaults to [TextInputAction.newline] if [keyboardType] is
/// [TextInputType.multiline] and [TextInputAction.done] otherwise.
final TextInputAction? textInputAction;
/// {@macro flutter.widgets.editableText.textCapitalization}
final TextCapitalization textCapitalization;
/// The style to use for the text being edited.
///
/// Also serves as a base for the [placeholder] text's style.
///
/// Defaults to the standard iOS font style from [CupertinoTheme] if null.
final TextStyle? style;
/// {@macro flutter.widgets.editableText.strutStyle}
final StrutStyle? strutStyle;
/// {@macro flutter.widgets.editableText.textAlign}
final TextAlign textAlign;
/// Configuration of toolbar options.
///
/// If not set, select all and paste will default to be enabled. Copy and cut
/// will be disabled if [obscureText] is true. If [readOnly] is true,
/// paste and cut will be disabled regardless.
@Deprecated(
'Use `contextMenuBuilder` instead. '
'This feature was deprecated after v3.3.0-0.5.pre.',
)
final ToolbarOptions? toolbarOptions;
/// {@macro flutter.material.InputDecorator.textAlignVertical}
final TextAlignVertical? textAlignVertical;
/// {@macro flutter.widgets.editableText.textDirection}
final TextDirection? textDirection;
/// {@macro flutter.widgets.editableText.readOnly}
final bool readOnly;
/// {@macro flutter.widgets.editableText.showCursor}
final bool? showCursor;
/// {@macro flutter.widgets.editableText.autofocus}
final bool autofocus;
/// {@macro flutter.widgets.editableText.obscuringCharacter}
final String obscuringCharacter;
/// {@macro flutter.widgets.editableText.obscureText}
final bool obscureText;
/// {@macro flutter.widgets.editableText.autocorrect}
final bool autocorrect;
/// {@macro flutter.services.TextInputConfiguration.smartDashesType}
final SmartDashesType smartDashesType;
/// {@macro flutter.services.TextInputConfiguration.smartQuotesType}
final SmartQuotesType smartQuotesType;
/// {@macro flutter.services.TextInputConfiguration.enableSuggestions}
final bool enableSuggestions;
/// {@macro flutter.widgets.editableText.maxLines}
/// * [expands], which determines whether the field should fill the height of
/// its parent.
final int? maxLines;
/// {@macro flutter.widgets.editableText.minLines}
/// * [expands], which determines whether the field should fill the height of
/// its parent.
final int? minLines;
/// {@macro flutter.widgets.editableText.expands}
final bool expands;
/// The maximum number of characters (Unicode grapheme clusters) to allow in
/// the text field.
///
/// After [maxLength] characters have been input, additional input
/// is ignored, unless [maxLengthEnforcement] is set to
/// [MaxLengthEnforcement.none].
///
/// The TextField enforces the length with a
/// [LengthLimitingTextInputFormatter], which is evaluated after the supplied
/// [inputFormatters], if any.
///
/// This value must be either null or greater than zero. If set to null
/// (the default), there is no limit to the number of characters allowed.
///
/// Whitespace characters (e.g. newline, space, tab) are included in the
/// character count.
///
/// {@macro flutter.services.lengthLimitingTextInputFormatter.maxLength}
final int? maxLength;
/// Determines how the [maxLength] limit should be enforced.
///
/// If [MaxLengthEnforcement.none] is set, additional input beyond [maxLength]
/// will not be enforced by the limit.
///
/// {@macro flutter.services.textFormatter.effectiveMaxLengthEnforcement}
///
/// {@macro flutter.services.textFormatter.maxLengthEnforcement}
final MaxLengthEnforcement? maxLengthEnforcement;
/// {@macro flutter.widgets.editableText.onChanged}
final ValueChanged<String>? onChanged;
/// {@macro flutter.widgets.editableText.onEditingComplete}
final VoidCallback? onEditingComplete;
/// {@macro flutter.widgets.editableText.onSubmitted}
///
/// See also:
///
/// * [TextInputAction.next] and [TextInputAction.previous], which
/// automatically shift the focus to the next/previous focusable item when
/// the user is done editing.
final ValueChanged<String>? onSubmitted;
/// {@macro flutter.widgets.editableText.onTapOutside}
final TapRegionCallback? onTapOutside;
/// {@macro flutter.widgets.editableText.inputFormatters}
final List<TextInputFormatter>? inputFormatters;
/// Disables the text field when false.
///
/// Text fields in disabled states have a light grey background and don't
/// respond to touch events including the [prefix], [suffix] and the clear
/// button.
///
/// Defaults to true.
final bool enabled;
/// {@macro flutter.widgets.editableText.cursorWidth}
final double cursorWidth;
/// {@macro flutter.widgets.editableText.cursorHeight}
final double? cursorHeight;
/// {@macro flutter.widgets.editableText.cursorRadius}
final Radius cursorRadius;
/// {@macro flutter.widgets.editableText.cursorOpacityAnimates}
final bool cursorOpacityAnimates;
/// The color to use when painting the cursor.
///
/// Defaults to the [DefaultSelectionStyle.cursorColor]. If that color is
/// null, it uses the [CupertinoThemeData.primaryColor] of the ambient theme,
/// which itself defaults to [CupertinoColors.activeBlue] in the light theme
/// and [CupertinoColors.activeOrange] in the dark theme.
final Color? cursorColor;
/// Controls how tall the selection highlight boxes are computed to be.
///
/// See [ui.BoxHeightStyle] for details on available styles.
final ui.BoxHeightStyle selectionHeightStyle;
/// Controls how wide the selection highlight boxes are computed to be.
///
/// See [ui.BoxWidthStyle] for details on available styles.
final ui.BoxWidthStyle selectionWidthStyle;
/// The appearance of the keyboard.
///
/// This setting is only honored on iOS devices.
///
/// If null, defaults to [Brightness.light].
final Brightness? keyboardAppearance;
/// {@macro flutter.widgets.editableText.scrollPadding}
final EdgeInsets scrollPadding;
/// {@macro flutter.widgets.editableText.enableInteractiveSelection}
final bool enableInteractiveSelection;
/// {@macro flutter.widgets.editableText.selectionControls}
final TextSelectionControls? selectionControls;
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
final DragStartBehavior dragStartBehavior;
/// {@macro flutter.widgets.editableText.scrollController}
final ScrollController? scrollController;
/// {@macro flutter.widgets.editableText.scrollPhysics}
final ScrollPhysics? scrollPhysics;
/// {@macro flutter.widgets.editableText.selectionEnabled}
bool get selectionEnabled => enableInteractiveSelection;
/// {@macro flutter.material.textfield.onTap}
final GestureTapCallback? onTap;
/// {@macro flutter.widgets.editableText.autofillHints}
/// {@macro flutter.services.AutofillConfiguration.autofillHints}
final Iterable<String>? autofillHints;
/// {@macro flutter.material.Material.clipBehavior}
///
/// Defaults to [Clip.hardEdge].
final Clip clipBehavior;
/// {@macro flutter.material.textfield.restorationId}
final String? restorationId;
/// {@macro flutter.widgets.editableText.scribbleEnabled}
final bool scribbleEnabled;
/// {@macro flutter.services.TextInputConfiguration.enableIMEPersonalizedLearning}
final bool enableIMEPersonalizedLearning;
/// {@macro flutter.widgets.editableText.contentInsertionConfiguration}
final ContentInsertionConfiguration? contentInsertionConfiguration;
/// {@macro flutter.widgets.EditableText.contextMenuBuilder}
///
/// If not provided, will build a default menu based on the platform.
///
/// See also:
///
/// * [CupertinoAdaptiveTextSelectionToolbar], which is built by default.
final EditableTextContextMenuBuilder? contextMenuBuilder;
static Widget _defaultContextMenuBuilder(BuildContext context, EditableTextState editableTextState) {
return CupertinoAdaptiveTextSelectionToolbar.editableText(
editableTextState: editableTextState,
);
}
/// Configuration for the text field magnifier.
///
/// By default (when this property is set to null), a [CupertinoTextMagnifier]
/// is used on mobile platforms, and nothing on desktop platforms. To suppress
/// the magnifier on all platforms, consider passing
/// [TextMagnifierConfiguration.disabled] explicitly.
///
/// {@macro flutter.widgets.magnifier.intro}
///
/// {@tool dartpad}
/// This sample demonstrates how to customize the magnifier that this text field uses.
///
/// ** See code in examples/api/lib/widgets/text_magnifier/text_magnifier.0.dart **
/// {@end-tool}
final TextMagnifierConfiguration? magnifierConfiguration;
/// {@macro flutter.widgets.EditableText.spellCheckConfiguration}
///
/// If [SpellCheckConfiguration.misspelledTextStyle] is not specified in this
/// configuration, then [cupertinoMisspelledTextStyle] is used by default.
final SpellCheckConfiguration? spellCheckConfiguration;
/// The [TextStyle] used to indicate misspelled words in the Cupertino style.
///
/// See also:
/// * [SpellCheckConfiguration.misspelledTextStyle], the style configured to
/// mark misspelled words with.
/// * [TextField.materialMisspelledTextStyle], the style configured
/// to mark misspelled words with in the Material style.
static const TextStyle cupertinoMisspelledTextStyle =
TextStyle(
decoration: TextDecoration.underline,
decorationColor: CupertinoColors.systemRed,
decorationStyle: TextDecorationStyle.dotted,
);
/// The color of the selection highlight when the spell check menu is visible.
///
/// Eyeballed from a screenshot taken on an iPhone 11 running iOS 16.2.
@visibleForTesting
static const Color kMisspelledSelectionColor = Color(0x62ff9699);
/// Default builder for the spell check suggestions toolbar in the Cupertino
/// style.
///
/// See also:
/// * [spellCheckConfiguration], where this is typically specified for
/// [CupertinoTextField].
/// * [SpellCheckConfiguration.spellCheckSuggestionsToolbarBuilder], the
/// parameter for which this is the default value for [CupertinoTextField].
/// * [TextField.defaultSpellCheckSuggestionsToolbarBuilder], which is like
/// this but specifies the default for [CupertinoTextField].
@visibleForTesting
static Widget defaultSpellCheckSuggestionsToolbarBuilder(
BuildContext context,
EditableTextState editableTextState,
) {
return CupertinoSpellCheckSuggestionsToolbar.editableText(
editableTextState: editableTextState,
);
}
/// {@macro flutter.widgets.undoHistory.controller}
final UndoHistoryController? undoController;
@override
State<CupertinoTextField> createState() => _CupertinoTextFieldState();
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<TextEditingController>('controller', controller, defaultValue: null));
properties.add(DiagnosticsProperty<FocusNode>('focusNode', focusNode, defaultValue: null));
properties.add(DiagnosticsProperty<UndoHistoryController>('undoController', undoController, defaultValue: null));
properties.add(DiagnosticsProperty<BoxDecoration>('decoration', decoration));
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('padding', padding));
properties.add(StringProperty('placeholder', placeholder));
properties.add(DiagnosticsProperty<TextStyle>('placeholderStyle', placeholderStyle));
properties.add(DiagnosticsProperty<OverlayVisibilityMode>('prefix', prefix == null ? null : prefixMode));
properties.add(DiagnosticsProperty<OverlayVisibilityMode>('suffix', suffix == null ? null : suffixMode));
properties.add(DiagnosticsProperty<OverlayVisibilityMode>('clearButtonMode', clearButtonMode));
properties.add(DiagnosticsProperty<String>('clearButtonSemanticLabel', clearButtonSemanticLabel));
properties.add(DiagnosticsProperty<TextInputType>('keyboardType', keyboardType, defaultValue: TextInputType.text));
properties.add(DiagnosticsProperty<TextStyle>('style', style, defaultValue: null));
properties.add(DiagnosticsProperty<bool>('autofocus', autofocus, defaultValue: false));
properties.add(DiagnosticsProperty<String>('obscuringCharacter', obscuringCharacter, defaultValue: '•'));
properties.add(DiagnosticsProperty<bool>('obscureText', obscureText, defaultValue: false));
properties.add(DiagnosticsProperty<bool>('autocorrect', autocorrect, defaultValue: true));
properties.add(EnumProperty<SmartDashesType>('smartDashesType', smartDashesType, defaultValue: obscureText ? SmartDashesType.disabled : SmartDashesType.enabled));
properties.add(EnumProperty<SmartQuotesType>('smartQuotesType', smartQuotesType, defaultValue: obscureText ? SmartQuotesType.disabled : SmartQuotesType.enabled));
properties.add(DiagnosticsProperty<bool>('enableSuggestions', enableSuggestions, defaultValue: true));
properties.add(IntProperty('maxLines', maxLines, defaultValue: 1));
properties.add(IntProperty('minLines', minLines, defaultValue: null));
properties.add(DiagnosticsProperty<bool>('expands', expands, defaultValue: false));
properties.add(IntProperty('maxLength', maxLength, defaultValue: null));
properties.add(EnumProperty<MaxLengthEnforcement>('maxLengthEnforcement', maxLengthEnforcement, defaultValue: null));
properties.add(DoubleProperty('cursorWidth', cursorWidth, defaultValue: 2.0));
properties.add(DoubleProperty('cursorHeight', cursorHeight, defaultValue: null));
properties.add(DiagnosticsProperty<Radius>('cursorRadius', cursorRadius, defaultValue: null));
properties.add(DiagnosticsProperty<bool>('cursorOpacityAnimates', cursorOpacityAnimates, defaultValue: true));
properties.add(createCupertinoColorProperty('cursorColor', cursorColor, defaultValue: null));
properties.add(FlagProperty('selectionEnabled', value: selectionEnabled, defaultValue: true, ifFalse: 'selection disabled'));
properties.add(DiagnosticsProperty<TextSelectionControls>('selectionControls', selectionControls, defaultValue: null));
properties.add(DiagnosticsProperty<ScrollController>('scrollController', scrollController, defaultValue: null));
properties.add(DiagnosticsProperty<ScrollPhysics>('scrollPhysics', scrollPhysics, defaultValue: null));
properties.add(EnumProperty<TextAlign>('textAlign', textAlign, defaultValue: TextAlign.start));
properties.add(DiagnosticsProperty<TextAlignVertical>('textAlignVertical', textAlignVertical, defaultValue: null));
properties.add(EnumProperty<TextDirection>('textDirection', textDirection, defaultValue: null));
properties.add(DiagnosticsProperty<Clip>('clipBehavior', clipBehavior, defaultValue: Clip.hardEdge));
properties.add(DiagnosticsProperty<bool>('scribbleEnabled', scribbleEnabled, defaultValue: true));
properties.add(DiagnosticsProperty<bool>('enableIMEPersonalizedLearning', enableIMEPersonalizedLearning, defaultValue: true));
properties.add(DiagnosticsProperty<SpellCheckConfiguration>('spellCheckConfiguration', spellCheckConfiguration, defaultValue: null));
properties.add(DiagnosticsProperty<List<String>>('contentCommitMimeTypes', contentInsertionConfiguration?.allowedMimeTypes ?? const <String>[], defaultValue: contentInsertionConfiguration == null ? const <String>[] : kDefaultContentInsertionMimeTypes));
}
static final TextMagnifierConfiguration _iosMagnifierConfiguration = TextMagnifierConfiguration(
magnifierBuilder: (
BuildContext context,
MagnifierController controller,
ValueNotifier<MagnifierInfo> magnifierInfo
) {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
case TargetPlatform.iOS:
return CupertinoTextMagnifier(
controller: controller,
magnifierInfo: magnifierInfo,
);
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
return null;
}
});
/// Returns a new [SpellCheckConfiguration] where the given configuration has
/// had any missing values replaced with their defaults for the iOS platform.
static SpellCheckConfiguration inferIOSSpellCheckConfiguration(
SpellCheckConfiguration? configuration,
) {
if (configuration == null
|| configuration == const SpellCheckConfiguration.disabled()) {
return const SpellCheckConfiguration.disabled();
}
return configuration.copyWith(
misspelledTextStyle: configuration.misspelledTextStyle
?? CupertinoTextField.cupertinoMisspelledTextStyle,
misspelledSelectionColor: configuration.misspelledSelectionColor
?? CupertinoTextField.kMisspelledSelectionColor,
spellCheckSuggestionsToolbarBuilder:
configuration.spellCheckSuggestionsToolbarBuilder
?? CupertinoTextField.defaultSpellCheckSuggestionsToolbarBuilder,
);
}
}
class _CupertinoTextFieldState extends State<CupertinoTextField> with RestorationMixin, AutomaticKeepAliveClientMixin<CupertinoTextField> implements TextSelectionGestureDetectorBuilderDelegate, AutofillClient {
final GlobalKey _clearGlobalKey = GlobalKey();
RestorableTextEditingController? _controller;
TextEditingController get _effectiveController => widget.controller ?? _controller!.value;
FocusNode? _focusNode;
FocusNode get _effectiveFocusNode => widget.focusNode ?? (_focusNode ??= FocusNode());
MaxLengthEnforcement get _effectiveMaxLengthEnforcement => widget.maxLengthEnforcement
?? LengthLimitingTextInputFormatter.getDefaultMaxLengthEnforcement();
bool _showSelectionHandles = false;
late _CupertinoTextFieldSelectionGestureDetectorBuilder _selectionGestureDetectorBuilder;
// API for TextSelectionGestureDetectorBuilderDelegate.
@override
bool get forcePressEnabled => true;
@override
final GlobalKey<EditableTextState> editableTextKey = GlobalKey<EditableTextState>();
@override
bool get selectionEnabled => widget.selectionEnabled;
// End of API for TextSelectionGestureDetectorBuilderDelegate.
@override
void initState() {
super.initState();
_selectionGestureDetectorBuilder = _CupertinoTextFieldSelectionGestureDetectorBuilder(
state: this,
);
if (widget.controller == null) {
_createLocalController();
}
_effectiveFocusNode.canRequestFocus = widget.enabled;
_effectiveFocusNode.addListener(_handleFocusChanged);
}
@override
void didUpdateWidget(CupertinoTextField oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.controller == null && oldWidget.controller != null) {
_createLocalController(oldWidget.controller!.value);
} else if (widget.controller != null && oldWidget.controller == null) {
unregisterFromRestoration(_controller!);
_controller!.dispose();
_controller = null;
}
if (widget.focusNode != oldWidget.focusNode) {
(oldWidget.focusNode ?? _focusNode)?.removeListener(_handleFocusChanged);
(widget.focusNode ?? _focusNode)?.addListener(_handleFocusChanged);
}
_effectiveFocusNode.canRequestFocus = widget.enabled;
}
@override
void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
if (_controller != null) {
_registerController();
}
}
void _registerController() {
assert(_controller != null);
registerForRestoration(_controller!, 'controller');
_controller!.value.addListener(updateKeepAlive);
}
void _createLocalController([TextEditingValue? value]) {
assert(_controller == null);
_controller = value == null
? RestorableTextEditingController()
: RestorableTextEditingController.fromValue(value);
if (!restorePending) {
_registerController();
}
}
@override
String? get restorationId => widget.restorationId;
@override
void dispose() {
_effectiveFocusNode.removeListener(_handleFocusChanged);
_focusNode?.dispose();
_controller?.dispose();
super.dispose();
}
EditableTextState get _editableText => editableTextKey.currentState!;
void _requestKeyboard() {
_editableText.requestKeyboard();
}
void _handleFocusChanged() {
setState(() {
// Rebuild the widget on focus change to show/hide the text selection
// highlight.
});
}
bool _shouldShowSelectionHandles(SelectionChangedCause? cause) {
// When the text field is activated by something that doesn't trigger the
// selection overlay, we shouldn't show the handles either.
if (!_selectionGestureDetectorBuilder.shouldShowSelectionToolbar) {
return false;
}
// On iOS, we don't show handles when the selection is collapsed.
if (_effectiveController.selection.isCollapsed) {
return false;
}
if (cause == SelectionChangedCause.keyboard) {
return false;
}
if (cause == SelectionChangedCause.scribble) {
return true;
}
if (_effectiveController.text.isNotEmpty) {
return true;
}
return false;
}
void _handleSelectionChanged(TextSelection selection, SelectionChangedCause? cause) {
final bool willShowSelectionHandles = _shouldShowSelectionHandles(cause);
if (willShowSelectionHandles != _showSelectionHandles) {
setState(() {
_showSelectionHandles = willShowSelectionHandles;
});
}
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
case TargetPlatform.linux:
case TargetPlatform.windows:
case TargetPlatform.fuchsia:
case TargetPlatform.android:
if (cause == SelectionChangedCause.longPress) {
_editableText.bringIntoView(selection.extent);
}
}
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
case TargetPlatform.android:
break;
case TargetPlatform.macOS:
case TargetPlatform.linux:
case TargetPlatform.windows:
if (cause == SelectionChangedCause.drag) {
_editableText.hideToolbar();
}
}
}
@override
bool get wantKeepAlive => _controller?.value.text.isNotEmpty ?? false;
static bool _shouldShowAttachment({
required OverlayVisibilityMode attachment,
required bool hasText,
}) {
return switch (attachment) {
OverlayVisibilityMode.never => false,
OverlayVisibilityMode.always => true,
OverlayVisibilityMode.editing => hasText,
OverlayVisibilityMode.notEditing => !hasText,
};
}
// True if any surrounding decoration widgets will be shown.
bool get _hasDecoration {
return widget.placeholder != null ||
widget.clearButtonMode != OverlayVisibilityMode.never ||
widget.prefix != null ||
widget.suffix != null;
}
// Provide default behavior if widget.textAlignVertical is not set.
// CupertinoTextField has top alignment by default, unless it has decoration
// like a prefix or suffix, in which case it's aligned to the center.
TextAlignVertical get _textAlignVertical {
if (widget.textAlignVertical != null) {
return widget.textAlignVertical!;
}
return _hasDecoration ? TextAlignVertical.center : TextAlignVertical.top;
}
void _onClearButtonTapped() {
final bool hadText = _effectiveController.text.isNotEmpty;
_effectiveController.clear();
if (hadText) {
// Tapping the clear button is also considered a "user initiated" change
// (instead of a programmatical one), so call `onChanged` if the text
// changed as a result.
widget.onChanged?.call(_effectiveController.text);
}
}
Widget _buildClearButton() {
final String clearLabel = widget.clearButtonSemanticLabel ?? CupertinoLocalizations.of(context).clearButtonLabel;
return Semantics(
button: true,
label: clearLabel,
child: GestureDetector(
key: _clearGlobalKey,
onTap: widget.enabled ? _onClearButtonTapped : null,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 6.0),
child: Icon(
CupertinoIcons.clear_thick_circled,
size: 18.0,
color: CupertinoDynamicColor.resolve(_kClearButtonColor, context),
),
),
),
);
}
Widget _addTextDependentAttachments(Widget editableText, TextStyle textStyle, TextStyle placeholderStyle) {
// If there are no surrounding widgets, just return the core editable text
// part.
if (!_hasDecoration) {
return editableText;
}
// Otherwise, listen to the current state of the text entry.
return ValueListenableBuilder<TextEditingValue>(
valueListenable: _effectiveController,
child: editableText,
builder: (BuildContext context, TextEditingValue text, Widget? child) {
final bool hasText = text.text.isNotEmpty;
final String? placeholderText = widget.placeholder;
final Widget? placeholder = placeholderText == null
? null
// Make the placeholder invisible when hasText is true.
: Visibility(
maintainAnimation: true,
maintainSize: true,
maintainState: true,
visible: !hasText,
child: SizedBox(
width: double.infinity,
child: Padding(
padding: widget.padding,
child: Text(
placeholderText,
// This is to make sure the text field is always tall enough
// to accommodate the first line of the placeholder, so the
// text does not shrink vertically as you type (however in
// rare circumstances, the height may still change when
// there's no placeholder text).
maxLines: hasText ? 1 : widget.maxLines,
overflow: placeholderStyle.overflow,
style: placeholderStyle,
textAlign: widget.textAlign,
),
),
),
);
final Widget? prefixWidget = _shouldShowAttachment(attachment: widget.prefixMode, hasText: hasText) ? widget.prefix : null;
// Show user specified suffix if applicable and fall back to clear button.
final bool showUserSuffix = _shouldShowAttachment(attachment: widget.suffixMode, hasText: hasText);
final bool showClearButton = _shouldShowAttachment(attachment: widget.clearButtonMode, hasText: hasText);
final Widget? suffixWidget = switch ((showUserSuffix, showClearButton)) {
(false, false) => null,
(true, false) => widget.suffix,
(true, true) => widget.suffix ?? _buildClearButton(),
(false, true) => _buildClearButton(),
};
return Row(children: <Widget>[
// Insert a prefix at the front if the prefix visibility mode matches
// the current text state.
if (prefixWidget != null) prefixWidget,
// In the middle part, stack the placeholder on top of the main EditableText
// if needed.
Expanded(
child: Stack(
// Ideally this should be baseline aligned. However that comes at
// the cost of the ability to compute the intrinsic dimensions of
// this widget.
// See also https://github.com/flutter/flutter/issues/13715.
alignment: AlignmentDirectional.center,
textDirection: widget.textDirection,
children: <Widget>[
if (placeholder != null) placeholder,
editableText,
],
),
),
if (suffixWidget != null) suffixWidget
]);
},
);
}
// AutofillClient implementation start.
@override
String get autofillId => _editableText.autofillId;
@override
void autofill(TextEditingValue newEditingValue) => _editableText.autofill(newEditingValue);
@override
TextInputConfiguration get textInputConfiguration {
final List<String>? autofillHints = widget.autofillHints?.toList(growable: false);
final AutofillConfiguration autofillConfiguration = autofillHints != null
? AutofillConfiguration(
uniqueIdentifier: autofillId,
autofillHints: autofillHints,
currentEditingValue: _effectiveController.value,
hintText: widget.placeholder,
)
: AutofillConfiguration.disabled;
return _editableText.textInputConfiguration.copyWith(autofillConfiguration: autofillConfiguration);
}
// AutofillClient implementation end.
@override
Widget build(BuildContext context) {
super.build(context); // See AutomaticKeepAliveClientMixin.
assert(debugCheckHasDirectionality(context));
final TextEditingController controller = _effectiveController;
TextSelectionControls? textSelectionControls = widget.selectionControls;
VoidCallback? handleDidGainAccessibilityFocus;
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
textSelectionControls ??= cupertinoTextSelectionHandleControls;
case TargetPlatform.macOS:
case TargetPlatform.windows:
textSelectionControls ??= cupertinoDesktopTextSelectionHandleControls;
handleDidGainAccessibilityFocus = () {
// Automatically activate the TextField when it receives accessibility focus.
if (!_effectiveFocusNode.hasFocus && _effectiveFocusNode.canRequestFocus) {
_effectiveFocusNode.requestFocus();
}
};
}
final bool enabled = widget.enabled;
final Offset cursorOffset = Offset(_iOSHorizontalCursorOffsetPixels / MediaQuery.devicePixelRatioOf(context), 0);
final List<TextInputFormatter> formatters = <TextInputFormatter>[
...?widget.inputFormatters,
if (widget.maxLength != null)
LengthLimitingTextInputFormatter(
widget.maxLength,
maxLengthEnforcement: _effectiveMaxLengthEnforcement,
),
];
final CupertinoThemeData themeData = CupertinoTheme.of(context);
final TextStyle? resolvedStyle = widget.style?.copyWith(
color: CupertinoDynamicColor.maybeResolve(widget.style?.color, context),
backgroundColor: CupertinoDynamicColor.maybeResolve(widget.style?.backgroundColor, context),
);
final TextStyle textStyle = themeData.textTheme.textStyle.merge(resolvedStyle);
final TextStyle? resolvedPlaceholderStyle = widget.placeholderStyle?.copyWith(
color: CupertinoDynamicColor.maybeResolve(widget.placeholderStyle?.color, context),
backgroundColor: CupertinoDynamicColor.maybeResolve(widget.placeholderStyle?.backgroundColor, context),
);
final TextStyle placeholderStyle = textStyle.merge(resolvedPlaceholderStyle);
final Brightness keyboardAppearance = widget.keyboardAppearance ?? CupertinoTheme.brightnessOf(context);
final Color cursorColor = CupertinoDynamicColor.maybeResolve(
widget.cursorColor ?? DefaultSelectionStyle.of(context).cursorColor,
context,
) ?? themeData.primaryColor;
final Color disabledColor = CupertinoDynamicColor.resolve(_kDisabledBackground, context);
final Color? decorationColor = CupertinoDynamicColor.maybeResolve(widget.decoration?.color, context);
final BoxBorder? border = widget.decoration?.border;
Border? resolvedBorder = border as Border?;
if (border is Border) {
BorderSide resolveBorderSide(BorderSide side) {
return side == BorderSide.none
? side
: side.copyWith(color: CupertinoDynamicColor.resolve(side.color, context));
}
resolvedBorder = border.runtimeType != Border
? border
: Border(
top: resolveBorderSide(border.top),
left: resolveBorderSide(border.left),
bottom: resolveBorderSide(border.bottom),
right: resolveBorderSide(border.right),
);
}
final BoxDecoration? effectiveDecoration = widget.decoration?.copyWith(
border: resolvedBorder,
color: enabled ? decorationColor : disabledColor,
);
final Color selectionColor = CupertinoDynamicColor.maybeResolve(
DefaultSelectionStyle.of(context).selectionColor,
context,
) ?? CupertinoTheme.of(context).primaryColor.withOpacity(0.2);
// Set configuration as disabled if not otherwise specified. If specified,
// ensure that configuration uses Cupertino text style for misspelled words
// unless a custom style is specified.
final SpellCheckConfiguration spellCheckConfiguration =
CupertinoTextField.inferIOSSpellCheckConfiguration(
widget.spellCheckConfiguration,
);
final Widget paddedEditable = Padding(
padding: widget.padding,
child: RepaintBoundary(
child: UnmanagedRestorationScope(
bucket: bucket,
child: EditableText(
key: editableTextKey,
controller: controller,
undoController: widget.undoController,
readOnly: widget.readOnly || !enabled,
toolbarOptions: widget.toolbarOptions,
showCursor: widget.showCursor,
showSelectionHandles: _showSelectionHandles,
focusNode: _effectiveFocusNode,
keyboardType: widget.keyboardType,
textInputAction: widget.textInputAction,
textCapitalization: widget.textCapitalization,
style: textStyle,
strutStyle: widget.strutStyle,
textAlign: widget.textAlign,
textDirection: widget.textDirection,
autofocus: widget.autofocus,
obscuringCharacter: widget.obscuringCharacter,
obscureText: widget.obscureText,
autocorrect: widget.autocorrect,
smartDashesType: widget.smartDashesType,
smartQuotesType: widget.smartQuotesType,
enableSuggestions: widget.enableSuggestions,
maxLines: widget.maxLines,
minLines: widget.minLines,
expands: widget.expands,
magnifierConfiguration: widget.magnifierConfiguration ?? CupertinoTextField._iosMagnifierConfiguration,
// Only show the selection highlight when the text field is focused.
selectionColor: _effectiveFocusNode.hasFocus ? selectionColor : null,
selectionControls: widget.selectionEnabled
? textSelectionControls : null,
onChanged: widget.onChanged,
onSelectionChanged: _handleSelectionChanged,
onEditingComplete: widget.onEditingComplete,
onSubmitted: widget.onSubmitted,
onTapOutside: widget.onTapOutside,
inputFormatters: formatters,
rendererIgnoresPointer: true,
cursorWidth: widget.cursorWidth,
cursorHeight: widget.cursorHeight,
cursorRadius: widget.cursorRadius,
cursorColor: cursorColor,
cursorOpacityAnimates: widget.cursorOpacityAnimates,
cursorOffset: cursorOffset,
paintCursorAboveText: true,
autocorrectionTextRectColor: selectionColor,
backgroundCursorColor: CupertinoDynamicColor.resolve(CupertinoColors.inactiveGray, context),
selectionHeightStyle: widget.selectionHeightStyle,
selectionWidthStyle: widget.selectionWidthStyle,
scrollPadding: widget.scrollPadding,
keyboardAppearance: keyboardAppearance,
dragStartBehavior: widget.dragStartBehavior,
scrollController: widget.scrollController,
scrollPhysics: widget.scrollPhysics,
enableInteractiveSelection: widget.enableInteractiveSelection,
autofillClient: this,
clipBehavior: widget.clipBehavior,
restorationId: 'editable',
scribbleEnabled: widget.scribbleEnabled,
enableIMEPersonalizedLearning: widget.enableIMEPersonalizedLearning,
contentInsertionConfiguration: widget.contentInsertionConfiguration,
contextMenuBuilder: widget.contextMenuBuilder,
spellCheckConfiguration: spellCheckConfiguration,
),
),
),
);
return Semantics(
enabled: enabled,
onTap: !enabled || widget.readOnly ? null : () {
if (!controller.selection.isValid) {
controller.selection = TextSelection.collapsed(offset: controller.text.length);
}
_requestKeyboard();
},
onDidGainAccessibilityFocus: handleDidGainAccessibilityFocus,
child: TextFieldTapRegion(
child: IgnorePointer(
ignoring: !enabled,
child: Container(
decoration: effectiveDecoration,
color: !enabled && effectiveDecoration == null ? disabledColor : null,
child: _selectionGestureDetectorBuilder.buildGestureDetector(
behavior: HitTestBehavior.translucent,
child: Align(
alignment: Alignment(-1.0, _textAlignVertical.y),
widthFactor: 1.0,
heightFactor: 1.0,
child: _addTextDependentAttachments(paddedEditable, textStyle, placeholderStyle),
),
),
),
),
),
);
}
}
| flutter/packages/flutter/lib/src/cupertino/text_field.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/cupertino/text_field.dart",
"repo_id": "flutter",
"token_count": 19456
} | 790 |
// 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 'isolates.dart' as isolates;
export 'isolates.dart' show ComputeCallback;
/// The dart:html implementation of [isolate.compute].
@pragma('dart2js:tryInline')
Future<R> compute<M, R>(isolates.ComputeCallback<M, R> callback, M message, { String? debugLabel }) async {
// To avoid blocking the UI immediately for an expensive function call, we
// pump a single frame to allow the framework to complete the current set
// of work.
await null;
return callback(message);
}
| flutter/packages/flutter/lib/src/foundation/_isolates_web.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/foundation/_isolates_web.dart",
"repo_id": "flutter",
"token_count": 188
} | 791 |
// 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 'dart:math' as math;
import 'dart:ui' show clampDouble;
import 'package:meta/meta.dart';
import 'assertions.dart';
import 'constants.dart';
import 'debug.dart';
import 'object.dart';
// Examples can assume:
// late int rows, columns;
// late String _name;
// late bool inherit;
// abstract class ExampleSuperclass with Diagnosticable { }
// late String message;
// late double stepWidth;
// late double scale;
// late double hitTestExtent;
// late double paintExtent;
// late double maxWidth;
// late double progress;
// late int maxLines;
// late Duration duration;
// late int depth;
// late bool primary;
// late bool isCurrent;
// late bool keepAlive;
// late bool obscureText;
// late TextAlign textAlign;
// late ImageRepeat repeat;
// late Widget widget;
// late List<BoxShadow> boxShadow;
// late Size size;
// late bool hasSize;
// late Matrix4 transform;
// late Color color;
// late Map<Listenable, VoidCallback>? handles;
// late DiagnosticsTreeStyle style;
// late IconData icon;
// late double devicePixelRatio;
/// The various priority levels used to filter which diagnostics are shown and
/// omitted.
///
/// Trees of Flutter diagnostics can be very large so filtering the diagnostics
/// shown matters. Typically filtering to only show diagnostics with at least
/// level [debug] is appropriate.
///
/// In release mode, this level may not have any effect, as diagnostics in
/// release mode are compacted or truncated to reduce binary size.
enum DiagnosticLevel {
/// Diagnostics that should not be shown.
///
/// If a user chooses to display [hidden] diagnostics, they should not expect
/// the diagnostics to be formatted consistently with other diagnostics and
/// they should expect them to sometimes be misleading. For example,
/// [FlagProperty] and [ObjectFlagProperty] have uglier formatting when the
/// property `value` does not match a value with a custom flag
/// description. An example of a misleading diagnostic is a diagnostic for
/// a property that has no effect because some other property of the object is
/// set in a way that causes the hidden property to have no effect.
hidden,
/// A diagnostic that is likely to be low value but where the diagnostic
/// display is just as high quality as a diagnostic with a higher level.
///
/// Use this level for diagnostic properties that match their default value
/// and other cases where showing a diagnostic would not add much value such
/// as an [IterableProperty] where the value is empty.
fine,
/// Diagnostics that should only be shown when performing fine grained
/// debugging of an object.
///
/// Unlike a [fine] diagnostic, these diagnostics provide important
/// information about the object that is likely to be needed to debug. Used by
/// properties that are important but where the property value is too verbose
/// (e.g. 300+ characters long) to show with a higher diagnostic level.
debug,
/// Interesting diagnostics that should be typically shown.
info,
/// Very important diagnostics that indicate problematic property values.
///
/// For example, use if you would write the property description
/// message in ALL CAPS.
warning,
/// Diagnostics that provide a hint about best practices.
///
/// For example, a diagnostic describing best practices for fixing an error.
hint,
/// Diagnostics that summarize other diagnostics present.
///
/// For example, use this level for a short one or two line summary
/// describing other diagnostics present.
summary,
/// Diagnostics that indicate errors or unexpected conditions.
///
/// For example, use for property values where computing the value throws an
/// exception.
error,
/// Special level indicating that no diagnostics should be shown.
///
/// Do not specify this level for diagnostics. This level is only used to
/// filter which diagnostics are shown.
off,
}
/// Styles for displaying a node in a [DiagnosticsNode] tree.
///
/// In release mode, these styles may be ignored, as diagnostics are compacted
/// or truncated to save on binary size.
///
/// See also:
///
/// * [DiagnosticsNode.toStringDeep], which dumps text art trees for these
/// styles.
enum DiagnosticsTreeStyle {
/// A style that does not display the tree, for release mode.
none,
/// Sparse style for displaying trees.
///
/// See also:
///
/// * [RenderObject], which uses this style.
sparse,
/// Connects a node to its parent with a dashed line.
///
/// See also:
///
/// * [RenderSliverMultiBoxAdaptor], which uses this style to distinguish
/// offstage children from onstage children.
offstage,
/// Slightly more compact version of the [sparse] style.
///
/// See also:
///
/// * [Element], which uses this style.
dense,
/// Style that enables transitioning from nodes of one style to children of
/// another.
///
/// See also:
///
/// * [RenderParagraph], which uses this style to display a [TextSpan] child
/// in a way that is compatible with the [DiagnosticsTreeStyle.sparse]
/// style of the [RenderObject] tree.
transition,
/// Style for displaying content describing an error.
///
/// See also:
///
/// * [FlutterError], which uses this style for the root node in a tree
/// describing an error.
error,
/// Render the tree just using whitespace without connecting parents to
/// children using lines.
///
/// See also:
///
/// * [SliverGeometry], which uses this style.
whitespace,
/// Render the tree without indenting children at all.
///
/// See also:
///
/// * [DiagnosticsStackTrace], which uses this style.
flat,
/// Render the tree on a single line without showing children.
singleLine,
/// Render the tree using a style appropriate for properties that are part
/// of an error message.
///
/// The name is placed on one line with the value and properties placed on
/// the following line.
///
/// See also:
///
/// * [singleLine], which displays the same information but keeps the
/// property and value on the same line.
errorProperty,
/// Render only the immediate properties of a node instead of the full tree.
///
/// See also:
///
/// * [DebugOverflowIndicatorMixin], which uses this style to display just
/// the immediate children of a node.
shallow,
/// Render only the children of a node truncating before the tree becomes too
/// large.
truncateChildren,
}
/// Configuration specifying how a particular [DiagnosticsTreeStyle] should be
/// rendered as text art.
///
/// In release mode, these configurations may be ignored, as diagnostics are
/// compacted or truncated to save on binary size.
///
/// See also:
///
/// * [sparseTextConfiguration], which is a typical style.
/// * [transitionTextConfiguration], which is an example of a complex tree style.
/// * [DiagnosticsNode.toStringDeep], for code using [TextTreeConfiguration]
/// to render text art for arbitrary trees of [DiagnosticsNode] objects.
class TextTreeConfiguration {
/// Create a configuration object describing how to render a tree as text.
TextTreeConfiguration({
required this.prefixLineOne,
required this.prefixOtherLines,
required this.prefixLastChildLineOne,
required this.prefixOtherLinesRootNode,
required this.linkCharacter,
required this.propertyPrefixIfChildren,
required this.propertyPrefixNoChildren,
this.lineBreak = '\n',
this.lineBreakProperties = true,
this.afterName = ':',
this.afterDescriptionIfBody = '',
this.afterDescription = '',
this.beforeProperties = '',
this.afterProperties = '',
this.mandatoryAfterProperties = '',
this.propertySeparator = '',
this.bodyIndent = '',
this.footer = '',
this.showChildren = true,
this.addBlankLineIfNoChildren = true,
this.isNameOnOwnLine = false,
this.isBlankLineBetweenPropertiesAndChildren = true,
this.beforeName = '',
this.suffixLineOne = '',
this.mandatoryFooter = '',
}) : childLinkSpace = ' ' * linkCharacter.length;
/// Prefix to add to the first line to display a child with this style.
final String prefixLineOne;
/// Suffix to add to end of the first line to make its length match the footer.
final String suffixLineOne;
/// Prefix to add to other lines to display a child with this style.
///
/// [prefixOtherLines] should typically be one character shorter than
/// [prefixLineOne] is.
final String prefixOtherLines;
/// Prefix to add to the first line to display the last child of a node with
/// this style.
final String prefixLastChildLineOne;
/// Additional prefix to add to other lines of a node if this is the root node
/// of the tree.
final String prefixOtherLinesRootNode;
/// Prefix to add before each property if the node as children.
///
/// Plays a similar role to [linkCharacter] except that some configurations
/// intentionally use a different line style than the [linkCharacter].
final String propertyPrefixIfChildren;
/// Prefix to add before each property if the node does not have children.
///
/// This string is typically a whitespace string the same length as
/// [propertyPrefixIfChildren] but can have a different length.
final String propertyPrefixNoChildren;
/// Character to use to draw line linking parent to child.
///
/// The first child does not require a line but all subsequent children do
/// with the line drawn immediately before the left edge of the previous
/// sibling.
final String linkCharacter;
/// Whitespace to draw instead of the childLink character if this node is the
/// last child of its parent so no link line is required.
final String childLinkSpace;
/// Character(s) to use to separate lines.
///
/// Typically leave set at the default value of '\n' unless this style needs
/// to treat lines differently as is the case for
/// [singleLineTextConfiguration].
final String lineBreak;
/// Whether to place line breaks between properties or to leave all
/// properties on one line.
final bool lineBreakProperties;
/// Text added immediately before the name of the node.
///
/// See [errorTextConfiguration] for an example of using this to achieve a
/// custom line art style.
final String beforeName;
/// Text added immediately after the name of the node.
///
/// See [transitionTextConfiguration] for an example of using a value other
/// than ':' to achieve a custom line art style.
final String afterName;
/// Text to add immediately after the description line of a node with
/// properties and/or children if the node has a body.
final String afterDescriptionIfBody;
/// Text to add immediately after the description line of a node with
/// properties and/or children.
final String afterDescription;
/// Optional string to add before the properties of a node.
///
/// Only displayed if the node has properties.
/// See [singleLineTextConfiguration] for an example of using this field
/// to enclose the property list with parenthesis.
final String beforeProperties;
/// Optional string to add after the properties of a node.
///
/// See documentation for [beforeProperties].
final String afterProperties;
/// Mandatory string to add after the properties of a node regardless of
/// whether the node has any properties.
final String mandatoryAfterProperties;
/// Property separator to add between properties.
///
/// See [singleLineTextConfiguration] for an example of using this field
/// to render properties as a comma separated list.
final String propertySeparator;
/// Prefix to add to all lines of the body of the tree node.
///
/// The body is all content in the node other than the name and description.
final String bodyIndent;
/// Whether the children of a node should be shown.
///
/// See [singleLineTextConfiguration] for an example of using this field to
/// hide all children of a node.
final bool showChildren;
/// Whether to add a blank line at the end of the output for a node if it has
/// no children.
///
/// See [denseTextConfiguration] for an example of setting this to false.
final bool addBlankLineIfNoChildren;
/// Whether the name should be displayed on the same line as the description.
final bool isNameOnOwnLine;
/// Footer to add as its own line at the end of a non-root node.
///
/// See [transitionTextConfiguration] for an example of using footer to draw a box
/// around the node. [footer] is indented the same amount as [prefixOtherLines].
final String footer;
/// Footer to add even for root nodes.
final String mandatoryFooter;
/// Add a blank line between properties and children if both are present.
final bool isBlankLineBetweenPropertiesAndChildren;
}
/// Default text tree configuration.
///
/// Example:
///
/// <root_name>: <root_description>
/// │ <property1>
/// │ <property2>
/// │ ...
/// │ <propertyN>
/// ├─<child_name>: <child_description>
/// │ │ <property1>
/// │ │ <property2>
/// │ │ ...
/// │ │ <propertyN>
/// │ │
/// │ └─<child_name>: <child_description>
/// │ <property1>
/// │ <property2>
/// │ ...
/// │ <propertyN>
/// │
/// └─<child_name>: <child_description>'
/// <property1>
/// <property2>
/// ...
/// <propertyN>
///
/// See also:
///
/// * [DiagnosticsTreeStyle.sparse], uses this style for ASCII art display.
final TextTreeConfiguration sparseTextConfiguration = TextTreeConfiguration(
prefixLineOne: '├─',
prefixOtherLines: ' ',
prefixLastChildLineOne: '└─',
linkCharacter: '│',
propertyPrefixIfChildren: '│ ',
propertyPrefixNoChildren: ' ',
prefixOtherLinesRootNode: ' ',
);
/// Identical to [sparseTextConfiguration] except that the lines connecting
/// parent to children are dashed.
///
/// Example:
///
/// <root_name>: <root_description>
/// │ <property1>
/// │ <property2>
/// │ ...
/// │ <propertyN>
/// ├─<normal_child_name>: <child_description>
/// ╎ │ <property1>
/// ╎ │ <property2>
/// ╎ │ ...
/// ╎ │ <propertyN>
/// ╎ │
/// ╎ └─<child_name>: <child_description>
/// ╎ <property1>
/// ╎ <property2>
/// ╎ ...
/// ╎ <propertyN>
/// ╎
/// ╎╌<dashed_child_name>: <child_description>
/// ╎ │ <property1>
/// ╎ │ <property2>
/// ╎ │ ...
/// ╎ │ <propertyN>
/// ╎ │
/// ╎ └─<child_name>: <child_description>
/// ╎ <property1>
/// ╎ <property2>
/// ╎ ...
/// ╎ <propertyN>
/// ╎
/// └╌<dashed_child_name>: <child_description>'
/// <property1>
/// <property2>
/// ...
/// <propertyN>
///
/// See also:
///
/// * [DiagnosticsTreeStyle.offstage], uses this style for ASCII art display.
final TextTreeConfiguration dashedTextConfiguration = TextTreeConfiguration(
prefixLineOne: '╎╌',
prefixLastChildLineOne: '└╌',
prefixOtherLines: ' ',
linkCharacter: '╎',
// Intentionally not set as a dashed line as that would make the properties
// look like they were disabled.
propertyPrefixIfChildren: '│ ',
propertyPrefixNoChildren: ' ',
prefixOtherLinesRootNode: ' ',
);
/// Dense text tree configuration that minimizes horizontal whitespace.
///
/// Example:
///
/// <root_name>: <root_description>(<property1>; <property2> <propertyN>)
/// ├<child_name>: <child_description>(<property1>, <property2>, <propertyN>)
/// └<child_name>: <child_description>(<property1>, <property2>, <propertyN>)
///
/// See also:
///
/// * [DiagnosticsTreeStyle.dense], uses this style for ASCII art display.
final TextTreeConfiguration denseTextConfiguration = TextTreeConfiguration(
propertySeparator: ', ',
beforeProperties: '(',
afterProperties: ')',
lineBreakProperties: false,
prefixLineOne: '├',
prefixOtherLines: '',
prefixLastChildLineOne: '└',
linkCharacter: '│',
propertyPrefixIfChildren: '│',
propertyPrefixNoChildren: ' ',
prefixOtherLinesRootNode: '',
addBlankLineIfNoChildren: false,
isBlankLineBetweenPropertiesAndChildren: false,
);
/// Configuration that draws a box around a leaf node.
///
/// Used by leaf nodes such as [TextSpan] to draw a clear border around the
/// contents of a node.
///
/// Example:
///
/// <parent_node>
/// ╞═╦══ <name> ═══
/// │ ║ <description>:
/// │ ║ <body>
/// │ ║ ...
/// │ ╚═══════════
/// ╘═╦══ <name> ═══
/// ║ <description>:
/// ║ <body>
/// ║ ...
/// ╚═══════════
///
/// See also:
///
/// * [DiagnosticsTreeStyle.transition], uses this style for ASCII art display.
final TextTreeConfiguration transitionTextConfiguration = TextTreeConfiguration(
prefixLineOne: '╞═╦══ ',
prefixLastChildLineOne: '╘═╦══ ',
prefixOtherLines: ' ║ ',
footer: ' ╚═══════════',
linkCharacter: '│',
// Subtree boundaries are clear due to the border around the node so omit the
// property prefix.
propertyPrefixIfChildren: '',
propertyPrefixNoChildren: '',
prefixOtherLinesRootNode: '',
afterName: ' ═══',
// Add a colon after the description if the node has a body to make the
// connection between the description and the body clearer.
afterDescriptionIfBody: ':',
// Members are indented an extra two spaces to disambiguate as the description
// is placed within the box instead of along side the name as is the case for
// other styles.
bodyIndent: ' ',
isNameOnOwnLine: true,
// No need to add a blank line as the footer makes the boundary of this
// subtree unambiguous.
addBlankLineIfNoChildren: false,
isBlankLineBetweenPropertiesAndChildren: false,
);
/// Configuration that draws a box around a node ignoring the connection to the
/// parents.
///
/// If nested in a tree, this node is best displayed in the property box rather
/// than as a traditional child.
///
/// Used to draw a decorative box around detailed descriptions of an exception.
///
/// Example:
///
/// ══╡ <name>: <description> ╞═════════════════════════════════════
/// <body>
/// ...
/// ├─<normal_child_name>: <child_description>
/// ╎ │ <property1>
/// ╎ │ <property2>
/// ╎ │ ...
/// ╎ │ <propertyN>
/// ╎ │
/// ╎ └─<child_name>: <child_description>
/// ╎ <property1>
/// ╎ <property2>
/// ╎ ...
/// ╎ <propertyN>
/// ╎
/// ╎╌<dashed_child_name>: <child_description>
/// ╎ │ <property1>
/// ╎ │ <property2>
/// ╎ │ ...
/// ╎ │ <propertyN>
/// ╎ │
/// ╎ └─<child_name>: <child_description>
/// ╎ <property1>
/// ╎ <property2>
/// ╎ ...
/// ╎ <propertyN>
/// ╎
/// └╌<dashed_child_name>: <child_description>'
/// ════════════════════════════════════════════════════════════════
///
/// See also:
///
/// * [DiagnosticsTreeStyle.error], uses this style for ASCII art display.
final TextTreeConfiguration errorTextConfiguration = TextTreeConfiguration(
prefixLineOne: '╞═╦',
prefixLastChildLineOne: '╘═╦',
prefixOtherLines: ' ║ ',
footer: ' ╚═══════════',
linkCharacter: '│',
// Subtree boundaries are clear due to the border around the node so omit the
// property prefix.
propertyPrefixIfChildren: '',
propertyPrefixNoChildren: '',
prefixOtherLinesRootNode: '',
beforeName: '══╡ ',
suffixLineOne: ' ╞══',
mandatoryFooter: '═════',
// No need to add a blank line as the footer makes the boundary of this
// subtree unambiguous.
addBlankLineIfNoChildren: false,
isBlankLineBetweenPropertiesAndChildren: false,
);
/// Whitespace only configuration where children are consistently indented
/// two spaces.
///
/// Use this style for displaying properties with structured values or for
/// displaying children within a [transitionTextConfiguration] as using a style that
/// draws line art would be visually distracting for those cases.
///
/// Example:
///
/// <parent_node>
/// <name>: <description>:
/// <properties>
/// <children>
/// <name>: <description>:
/// <properties>
/// <children>
///
/// See also:
///
/// * [DiagnosticsTreeStyle.whitespace], uses this style for ASCII art display.
final TextTreeConfiguration whitespaceTextConfiguration = TextTreeConfiguration(
prefixLineOne: '',
prefixLastChildLineOne: '',
prefixOtherLines: ' ',
prefixOtherLinesRootNode: ' ',
propertyPrefixIfChildren: '',
propertyPrefixNoChildren: '',
linkCharacter: ' ',
addBlankLineIfNoChildren: false,
// Add a colon after the description and before the properties to link the
// properties to the description line.
afterDescriptionIfBody: ':',
isBlankLineBetweenPropertiesAndChildren: false,
);
/// Whitespace only configuration where children are not indented.
///
/// Use this style when indentation is not needed to disambiguate parents from
/// children as in the case of a [DiagnosticsStackTrace].
///
/// Example:
///
/// <parent_node>
/// <name>: <description>:
/// <properties>
/// <children>
/// <name>: <description>:
/// <properties>
/// <children>
///
/// See also:
///
/// * [DiagnosticsTreeStyle.flat], uses this style for ASCII art display.
final TextTreeConfiguration flatTextConfiguration = TextTreeConfiguration(
prefixLineOne: '',
prefixLastChildLineOne: '',
prefixOtherLines: '',
prefixOtherLinesRootNode: '',
propertyPrefixIfChildren: '',
propertyPrefixNoChildren: '',
linkCharacter: '',
addBlankLineIfNoChildren: false,
// Add a colon after the description and before the properties to link the
// properties to the description line.
afterDescriptionIfBody: ':',
isBlankLineBetweenPropertiesAndChildren: false,
);
/// Render a node as a single line omitting children.
///
/// Example:
/// `<name>: <description>(<property1>, <property2>, ..., <propertyN>)`
///
/// See also:
///
/// * [DiagnosticsTreeStyle.singleLine], uses this style for ASCII art display.
final TextTreeConfiguration singleLineTextConfiguration = TextTreeConfiguration(
propertySeparator: ', ',
beforeProperties: '(',
afterProperties: ')',
prefixLineOne: '',
prefixOtherLines: '',
prefixLastChildLineOne: '',
lineBreak: '',
lineBreakProperties: false,
addBlankLineIfNoChildren: false,
showChildren: false,
propertyPrefixIfChildren: ' ',
propertyPrefixNoChildren: ' ',
linkCharacter: '',
prefixOtherLinesRootNode: '',
);
/// Render the name on a line followed by the body and properties on the next
/// line omitting the children.
///
/// Example:
///
/// <name>:
/// <description>(<property1>, <property2>, ..., <propertyN>)
///
/// See also:
///
/// * [DiagnosticsTreeStyle.errorProperty], uses this style for ASCII art
/// display.
final TextTreeConfiguration errorPropertyTextConfiguration = TextTreeConfiguration(
propertySeparator: ', ',
beforeProperties: '(',
afterProperties: ')',
prefixLineOne: '',
prefixOtherLines: '',
prefixLastChildLineOne: '',
lineBreakProperties: false,
addBlankLineIfNoChildren: false,
showChildren: false,
propertyPrefixIfChildren: ' ',
propertyPrefixNoChildren: ' ',
linkCharacter: '',
prefixOtherLinesRootNode: '',
isNameOnOwnLine: true,
);
/// Render a node on multiple lines omitting children.
///
/// Example:
/// `<name>: <description>
/// <property1>
/// <property2>
/// <propertyN>`
///
/// See also:
///
/// * [DiagnosticsTreeStyle.shallow]
final TextTreeConfiguration shallowTextConfiguration = TextTreeConfiguration(
prefixLineOne: '',
prefixLastChildLineOne: '',
prefixOtherLines: ' ',
prefixOtherLinesRootNode: ' ',
propertyPrefixIfChildren: '',
propertyPrefixNoChildren: '',
linkCharacter: ' ',
addBlankLineIfNoChildren: false,
// Add a colon after the description and before the properties to link the
// properties to the description line.
afterDescriptionIfBody: ':',
isBlankLineBetweenPropertiesAndChildren: false,
showChildren: false,
);
enum _WordWrapParseMode { inSpace, inWord, atBreak }
/// Builder that builds a String with specified prefixes for the first and
/// subsequent lines.
///
/// Allows for the incremental building of strings using `write*()` methods.
/// The strings are concatenated into a single string with the first line
/// prefixed by [prefixLineOne] and subsequent lines prefixed by
/// [prefixOtherLines].
class _PrefixedStringBuilder {
_PrefixedStringBuilder({
required this.prefixLineOne,
required String? prefixOtherLines,
this.wrapWidth,
}) : _prefixOtherLines = prefixOtherLines;
/// Prefix to add to the first line.
final String prefixLineOne;
/// Prefix to add to subsequent lines.
///
/// The prefix can be modified while the string is being built in which case
/// subsequent lines will be added with the modified prefix.
String? get prefixOtherLines => _nextPrefixOtherLines ?? _prefixOtherLines;
String? _prefixOtherLines;
set prefixOtherLines(String? prefix) {
_prefixOtherLines = prefix;
_nextPrefixOtherLines = null;
}
String? _nextPrefixOtherLines;
void incrementPrefixOtherLines(String suffix, {required bool updateCurrentLine}) {
if (_currentLine.isEmpty || updateCurrentLine) {
_prefixOtherLines = prefixOtherLines! + suffix;
_nextPrefixOtherLines = null;
} else {
_nextPrefixOtherLines = prefixOtherLines! + suffix;
}
}
final int? wrapWidth;
/// Buffer containing lines that have already been completely laid out.
final StringBuffer _buffer = StringBuffer();
/// Buffer containing the current line that has not yet been wrapped.
final StringBuffer _currentLine = StringBuffer();
/// List of pairs of integers indicating the start and end of each block of
/// text within _currentLine that can be wrapped.
final List<int> _wrappableRanges = <int>[];
/// Whether the string being built already has more than 1 line.
bool get requiresMultipleLines => _numLines > 1 || (_numLines == 1 && _currentLine.isNotEmpty) ||
(_currentLine.length + _getCurrentPrefix(true)!.length > wrapWidth!);
bool get isCurrentLineEmpty => _currentLine.isEmpty;
int _numLines = 0;
void _finalizeLine(bool addTrailingLineBreak) {
final bool firstLine = _buffer.isEmpty;
final String text = _currentLine.toString();
_currentLine.clear();
if (_wrappableRanges.isEmpty) {
// Fast path. There were no wrappable spans of text.
_writeLine(
text,
includeLineBreak: addTrailingLineBreak,
firstLine: firstLine,
);
return;
}
final Iterable<String> lines = _wordWrapLine(
text,
_wrappableRanges,
wrapWidth!,
startOffset: firstLine ? prefixLineOne.length : _prefixOtherLines!.length,
otherLineOffset: _prefixOtherLines!.length,
);
int i = 0;
final int length = lines.length;
for (final String line in lines) {
i++;
_writeLine(
line,
includeLineBreak: addTrailingLineBreak || i < length,
firstLine: firstLine,
);
}
_wrappableRanges.clear();
}
/// Wraps the given string at the given width.
///
/// Wrapping occurs at space characters (U+0020).
///
/// This is not suitable for use with arbitrary Unicode text. For example, it
/// doesn't implement UAX #14, can't handle ideographic text, doesn't hyphenate,
/// and so forth. It is only intended for formatting error messages.
///
/// This method wraps a sequence of text where only some spans of text can be
/// used as wrap boundaries.
static Iterable<String> _wordWrapLine(String message, List<int> wrapRanges, int width, { int startOffset = 0, int otherLineOffset = 0}) {
if (message.length + startOffset < width) {
// Nothing to do. The line doesn't wrap.
return <String>[message];
}
final List<String> wrappedLine = <String>[];
int startForLengthCalculations = -startOffset;
bool addPrefix = false;
int index = 0;
_WordWrapParseMode mode = _WordWrapParseMode.inSpace;
late int lastWordStart;
int? lastWordEnd;
int start = 0;
int currentChunk = 0;
// This helper is called with increasing indexes.
bool noWrap(int index) {
while (true) {
if (currentChunk >= wrapRanges.length) {
return true;
}
if (index < wrapRanges[currentChunk + 1]) {
break; // Found nearest chunk.
}
currentChunk+= 2;
}
return index < wrapRanges[currentChunk];
}
while (true) {
switch (mode) {
case _WordWrapParseMode.inSpace: // at start of break point (or start of line); can't break until next break
while ((index < message.length) && (message[index] == ' ')) {
index += 1;
}
lastWordStart = index;
mode = _WordWrapParseMode.inWord;
case _WordWrapParseMode.inWord: // looking for a good break point. Treat all text
while ((index < message.length) && (message[index] != ' ' || noWrap(index))) {
index += 1;
}
mode = _WordWrapParseMode.atBreak;
case _WordWrapParseMode.atBreak: // at start of break point
if ((index - startForLengthCalculations > width) || (index == message.length)) {
// we are over the width line, so break
if ((index - startForLengthCalculations <= width) || (lastWordEnd == null)) {
// we should use this point, because either it doesn't actually go over the
// end (last line), or it does, but there was no earlier break point
lastWordEnd = index;
}
final String line = message.substring(start, lastWordEnd);
wrappedLine.add(line);
addPrefix = true;
if (lastWordEnd >= message.length) {
return wrappedLine;
}
// just yielded a line
if (lastWordEnd == index) {
// we broke at current position
// eat all the wrappable spaces, then set our start point
// Even if some of the spaces are not wrappable that is ok.
while ((index < message.length) && (message[index] == ' ')) {
index += 1;
}
start = index;
mode = _WordWrapParseMode.inWord;
} else {
// we broke at the previous break point, and we're at the start of a new one
assert(lastWordStart > lastWordEnd);
start = lastWordStart;
mode = _WordWrapParseMode.atBreak;
}
startForLengthCalculations = start - otherLineOffset;
assert(addPrefix);
lastWordEnd = null;
} else {
// save this break point, we're not yet over the line width
lastWordEnd = index;
// skip to the end of this break point
mode = _WordWrapParseMode.inSpace;
}
}
}
}
/// Write text ensuring the specified prefixes for the first and subsequent
/// lines.
///
/// If [allowWrap] is true, the text may be wrapped to stay within the
/// allow `wrapWidth`.
void write(String s, {bool allowWrap = false}) {
if (s.isEmpty) {
return;
}
final List<String> lines = s.split('\n');
for (int i = 0; i < lines.length; i += 1) {
if (i > 0) {
_finalizeLine(true);
_updatePrefix();
}
final String line = lines[i];
if (line.isNotEmpty) {
if (allowWrap && wrapWidth != null) {
final int wrapStart = _currentLine.length;
final int wrapEnd = wrapStart + line.length;
if (_wrappableRanges.isNotEmpty && _wrappableRanges.last == wrapStart) {
// Extend last range.
_wrappableRanges.last = wrapEnd;
} else {
_wrappableRanges..add(wrapStart)..add(wrapEnd);
}
}
_currentLine.write(line);
}
}
}
void _updatePrefix() {
if (_nextPrefixOtherLines != null) {
_prefixOtherLines = _nextPrefixOtherLines;
_nextPrefixOtherLines = null;
}
}
void _writeLine(
String line, {
required bool includeLineBreak,
required bool firstLine,
}) {
line = '${_getCurrentPrefix(firstLine)}$line';
_buffer.write(line.trimRight());
if (includeLineBreak) {
_buffer.write('\n');
}
_numLines++;
}
String? _getCurrentPrefix(bool firstLine) {
return _buffer.isEmpty ? prefixLineOne : _prefixOtherLines;
}
/// Write lines assuming the lines obey the specified prefixes. Ensures that
/// a newline is added if one is not present.
void writeRawLines(String lines) {
if (lines.isEmpty) {
return;
}
if (_currentLine.isNotEmpty) {
_finalizeLine(true);
}
assert (_currentLine.isEmpty);
_buffer.write(lines);
if (!lines.endsWith('\n')) {
_buffer.write('\n');
}
_numLines++;
_updatePrefix();
}
/// Finishes the current line with a stretched version of text.
void writeStretched(String text, int targetLineLength) {
write(text);
final int currentLineLength = _currentLine.length + _getCurrentPrefix(_buffer.isEmpty)!.length;
assert (_currentLine.length > 0);
final int targetLength = targetLineLength - currentLineLength;
if (targetLength > 0) {
assert(text.isNotEmpty);
final String lastChar = text[text.length - 1];
assert(lastChar != '\n');
_currentLine.write(lastChar * targetLength);
}
// Mark the entire line as not wrappable.
_wrappableRanges.clear();
}
String build() {
if (_currentLine.isNotEmpty) {
_finalizeLine(false);
}
return _buffer.toString();
}
}
class _NoDefaultValue {
const _NoDefaultValue();
}
/// Marker object indicating that a [DiagnosticsNode] has no default value.
const Object kNoDefaultValue = _NoDefaultValue();
bool _isSingleLine(DiagnosticsTreeStyle? style) {
return style == DiagnosticsTreeStyle.singleLine;
}
/// Renderer that creates ASCII art representations of trees of
/// [DiagnosticsNode] objects.
///
/// See also:
///
/// * [DiagnosticsNode.toStringDeep], which uses a [TextTreeRenderer] to return a
/// string representation of this node and its descendants.
class TextTreeRenderer {
/// Creates a [TextTreeRenderer] object with the given arguments specifying
/// how the tree is rendered.
///
/// Lines are wrapped to at the maximum of [wrapWidth] and the current indent
/// plus [wrapWidthProperties] characters. This ensures that wrapping does not
/// become too excessive when displaying very deep trees and that wrapping
/// only occurs at the overall [wrapWidth] when the tree is not very indented.
/// If [maxDescendentsTruncatableNode] is specified, [DiagnosticsNode] objects
/// with `allowTruncate` set to `true` are truncated after including
/// [maxDescendentsTruncatableNode] descendants of the node to be truncated.
TextTreeRenderer({
DiagnosticLevel minLevel = DiagnosticLevel.debug,
int wrapWidth = 100,
int wrapWidthProperties = 65,
int maxDescendentsTruncatableNode = -1,
}) : _minLevel = minLevel,
_wrapWidth = wrapWidth,
_wrapWidthProperties = wrapWidthProperties,
_maxDescendentsTruncatableNode = maxDescendentsTruncatableNode;
final int _wrapWidth;
final int _wrapWidthProperties;
final DiagnosticLevel _minLevel;
final int _maxDescendentsTruncatableNode;
/// Text configuration to use to connect this node to a `child`.
///
/// The singleLine styles are special cased because the connection from the
/// parent to the child should be consistent with the parent's style as the
/// single line style does not provide any meaningful style for how children
/// should be connected to their parents.
TextTreeConfiguration? _childTextConfiguration(
DiagnosticsNode child,
TextTreeConfiguration textStyle,
) {
final DiagnosticsTreeStyle? childStyle = child.style;
return (_isSingleLine(childStyle) || childStyle == DiagnosticsTreeStyle.errorProperty) ? textStyle : child.textTreeConfiguration;
}
/// Renders a [node] to a String.
String render(
DiagnosticsNode node, {
String prefixLineOne = '',
String? prefixOtherLines,
TextTreeConfiguration? parentConfiguration,
}) {
if (kReleaseMode) {
return '';
} else {
return _debugRender(
node,
prefixLineOne: prefixLineOne,
prefixOtherLines: prefixOtherLines,
parentConfiguration: parentConfiguration,
);
}
}
String _debugRender(
DiagnosticsNode node, {
String prefixLineOne = '',
String? prefixOtherLines,
TextTreeConfiguration? parentConfiguration,
}) {
final bool isSingleLine = _isSingleLine(node.style) && parentConfiguration?.lineBreakProperties != true;
prefixOtherLines ??= prefixLineOne;
if (node.linePrefix != null) {
prefixLineOne += node.linePrefix!;
prefixOtherLines += node.linePrefix!;
}
final TextTreeConfiguration config = node.textTreeConfiguration!;
if (prefixOtherLines.isEmpty) {
prefixOtherLines += config.prefixOtherLinesRootNode;
}
if (node.style == DiagnosticsTreeStyle.truncateChildren) {
// This style is different enough that it isn't worthwhile to reuse the
// existing logic.
final List<String> descendants = <String>[];
const int maxDepth = 5;
int depth = 0;
const int maxLines = 25;
int lines = 0;
void visitor(DiagnosticsNode node) {
for (final DiagnosticsNode child in node.getChildren()) {
if (lines < maxLines) {
depth += 1;
descendants.add('$prefixOtherLines${" " * depth}$child');
if (depth < maxDepth) {
visitor(child);
}
depth -= 1;
} else if (lines == maxLines) {
descendants.add('$prefixOtherLines ...(descendants list truncated after $lines lines)');
}
lines += 1;
}
}
visitor(node);
final StringBuffer information = StringBuffer(prefixLineOne);
if (lines > 1) {
information.writeln('This ${node.name} had the following descendants (showing up to depth $maxDepth):');
} else if (descendants.length == 1) {
information.writeln('This ${node.name} had the following child:');
} else {
information.writeln('This ${node.name} has no descendants.');
}
information.writeAll(descendants, '\n');
return information.toString();
}
final _PrefixedStringBuilder builder = _PrefixedStringBuilder(
prefixLineOne: prefixLineOne,
prefixOtherLines: prefixOtherLines,
wrapWidth: math.max(_wrapWidth, prefixOtherLines.length + _wrapWidthProperties),
);
List<DiagnosticsNode> children = node.getChildren();
String description = node.toDescription(parentConfiguration: parentConfiguration);
if (config.beforeName.isNotEmpty) {
builder.write(config.beforeName);
}
final bool wrapName = !isSingleLine && node.allowNameWrap;
final bool wrapDescription = !isSingleLine && node.allowWrap;
final bool uppercaseTitle = node.style == DiagnosticsTreeStyle.error;
String? name = node.name;
if (uppercaseTitle) {
name = name?.toUpperCase();
}
if (description.isEmpty) {
if (node.showName && name != null) {
builder.write(name, allowWrap: wrapName);
}
} else {
bool includeName = false;
if (name != null && name.isNotEmpty && node.showName) {
includeName = true;
builder.write(name, allowWrap: wrapName);
if (node.showSeparator) {
builder.write(config.afterName, allowWrap: wrapName);
}
builder.write(
config.isNameOnOwnLine || description.contains('\n') ? '\n' : ' ',
allowWrap: wrapName,
);
}
if (!isSingleLine && builder.requiresMultipleLines && !builder.isCurrentLineEmpty) {
// Make sure there is a break between the current line and next one if
// there is not one already.
builder.write('\n');
}
if (includeName) {
builder.incrementPrefixOtherLines(
children.isEmpty ? config.propertyPrefixNoChildren : config.propertyPrefixIfChildren,
updateCurrentLine: true,
);
}
if (uppercaseTitle) {
description = description.toUpperCase();
}
builder.write(description.trimRight(), allowWrap: wrapDescription);
if (!includeName) {
builder.incrementPrefixOtherLines(
children.isEmpty ? config.propertyPrefixNoChildren : config.propertyPrefixIfChildren,
updateCurrentLine: false,
);
}
}
if (config.suffixLineOne.isNotEmpty) {
builder.writeStretched(config.suffixLineOne, builder.wrapWidth!);
}
final Iterable<DiagnosticsNode> propertiesIterable = node.getProperties().where(
(DiagnosticsNode n) => !n.isFiltered(_minLevel),
);
List<DiagnosticsNode> properties;
if (_maxDescendentsTruncatableNode >= 0 && node.allowTruncate) {
if (propertiesIterable.length < _maxDescendentsTruncatableNode) {
properties =
propertiesIterable.take(_maxDescendentsTruncatableNode).toList();
properties.add(DiagnosticsNode.message('...'));
} else {
properties = propertiesIterable.toList();
}
if (_maxDescendentsTruncatableNode < children.length) {
children = children.take(_maxDescendentsTruncatableNode).toList();
children.add(DiagnosticsNode.message('...'));
}
} else {
properties = propertiesIterable.toList();
}
// If the node does not show a separator and there is no description then
// we should not place a separator between the name and the value.
// Essentially in this case the properties are treated a bit like a value.
if ((properties.isNotEmpty || children.isNotEmpty || node.emptyBodyDescription != null) &&
(node.showSeparator || description.isNotEmpty)) {
builder.write(config.afterDescriptionIfBody);
}
if (config.lineBreakProperties) {
builder.write(config.lineBreak);
}
if (properties.isNotEmpty) {
builder.write(config.beforeProperties);
}
builder.incrementPrefixOtherLines(config.bodyIndent, updateCurrentLine: false);
if (node.emptyBodyDescription != null &&
properties.isEmpty &&
children.isEmpty &&
prefixLineOne.isNotEmpty) {
builder.write(node.emptyBodyDescription!);
if (config.lineBreakProperties) {
builder.write(config.lineBreak);
}
}
for (int i = 0; i < properties.length; ++i) {
final DiagnosticsNode property = properties[i];
if (i > 0) {
builder.write(config.propertySeparator);
}
final TextTreeConfiguration propertyStyle = property.textTreeConfiguration!;
if (_isSingleLine(property.style)) {
// We have to treat single line properties slightly differently to deal
// with cases where a single line properties output may not have single
// linebreak.
final String propertyRender = render(property,
prefixLineOne: propertyStyle.prefixLineOne,
prefixOtherLines: '${propertyStyle.childLinkSpace}${propertyStyle.prefixOtherLines}',
parentConfiguration: config,
);
final List<String> propertyLines = propertyRender.split('\n');
if (propertyLines.length == 1 && !config.lineBreakProperties) {
builder.write(propertyLines.first);
} else {
builder.write(propertyRender);
if (!propertyRender.endsWith('\n')) {
builder.write('\n');
}
}
} else {
final String propertyRender = render(property,
prefixLineOne: '${builder.prefixOtherLines}${propertyStyle.prefixLineOne}',
prefixOtherLines: '${builder.prefixOtherLines}${propertyStyle.childLinkSpace}${propertyStyle.prefixOtherLines}',
parentConfiguration: config,
);
builder.writeRawLines(propertyRender);
}
}
if (properties.isNotEmpty) {
builder.write(config.afterProperties);
}
builder.write(config.mandatoryAfterProperties);
if (!config.lineBreakProperties) {
builder.write(config.lineBreak);
}
final String prefixChildren = config.bodyIndent;
final String prefixChildrenRaw = '$prefixOtherLines$prefixChildren';
if (children.isEmpty &&
config.addBlankLineIfNoChildren &&
builder.requiresMultipleLines &&
builder.prefixOtherLines!.trimRight().isNotEmpty
) {
builder.write(config.lineBreak);
}
if (children.isNotEmpty && config.showChildren) {
if (config.isBlankLineBetweenPropertiesAndChildren &&
properties.isNotEmpty &&
children.first.textTreeConfiguration!.isBlankLineBetweenPropertiesAndChildren) {
builder.write(config.lineBreak);
}
builder.prefixOtherLines = prefixOtherLines;
for (int i = 0; i < children.length; i++) {
final DiagnosticsNode child = children[i];
final TextTreeConfiguration childConfig = _childTextConfiguration(child, config)!;
if (i == children.length - 1) {
final String lastChildPrefixLineOne = '$prefixChildrenRaw${childConfig.prefixLastChildLineOne}';
final String childPrefixOtherLines = '$prefixChildrenRaw${childConfig.childLinkSpace}${childConfig.prefixOtherLines}';
builder.writeRawLines(render(
child,
prefixLineOne: lastChildPrefixLineOne,
prefixOtherLines: childPrefixOtherLines,
parentConfiguration: config,
));
if (childConfig.footer.isNotEmpty) {
builder.prefixOtherLines = prefixChildrenRaw;
builder.write('${childConfig.childLinkSpace}${childConfig.footer}');
if (childConfig.mandatoryFooter.isNotEmpty) {
builder.writeStretched(
childConfig.mandatoryFooter,
math.max(builder.wrapWidth!, _wrapWidthProperties + childPrefixOtherLines.length),
);
}
builder.write(config.lineBreak);
}
} else {
final TextTreeConfiguration nextChildStyle = _childTextConfiguration(children[i + 1], config)!;
final String childPrefixLineOne = '$prefixChildrenRaw${childConfig.prefixLineOne}';
final String childPrefixOtherLines ='$prefixChildrenRaw${nextChildStyle.linkCharacter}${childConfig.prefixOtherLines}';
builder.writeRawLines(render(
child,
prefixLineOne: childPrefixLineOne,
prefixOtherLines: childPrefixOtherLines,
parentConfiguration: config,
));
if (childConfig.footer.isNotEmpty) {
builder.prefixOtherLines = prefixChildrenRaw;
builder.write('${childConfig.linkCharacter}${childConfig.footer}');
if (childConfig.mandatoryFooter.isNotEmpty) {
builder.writeStretched(
childConfig.mandatoryFooter,
math.max(builder.wrapWidth!, _wrapWidthProperties + childPrefixOtherLines.length),
);
}
builder.write(config.lineBreak);
}
}
}
}
if (parentConfiguration == null && config.mandatoryFooter.isNotEmpty) {
builder.writeStretched(config.mandatoryFooter, builder.wrapWidth!);
builder.write(config.lineBreak);
}
return builder.build();
}
}
/// Defines diagnostics data for a [value].
///
/// For debug and profile modes, [DiagnosticsNode] provides a high quality
/// multiline string dump via [toStringDeep]. The core members are the [name],
/// [toDescription], [getProperties], [value], and [getChildren]. All other
/// members exist typically to provide hints for how [toStringDeep] and
/// debugging tools should format output.
///
/// In release mode, far less information is retained and some information may
/// not print at all.
abstract class DiagnosticsNode {
/// Initializes the object.
///
/// The [style], [showName], and [showSeparator] arguments must not
/// be null.
DiagnosticsNode({
required this.name,
this.style,
this.showName = true,
this.showSeparator = true,
this.linePrefix,
}) : assert(
// A name ending with ':' indicates that the user forgot that the ':' will
// be automatically added for them when generating descriptions of the
// property.
name == null || !name.endsWith(':'),
'Names of diagnostic nodes must not end with colons.\n'
'name:\n'
' "$name"',
);
/// Diagnostics containing just a string `message` and not a concrete name or
/// value.
///
/// See also:
///
/// * [MessageProperty], which is better suited to messages that are to be
/// formatted like a property with a separate name and message.
factory DiagnosticsNode.message(
String message, {
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info,
bool allowWrap = true,
}) {
return DiagnosticsProperty<void>(
'',
null,
description: message,
style: style,
showName: false,
allowWrap: allowWrap,
level: level,
);
}
/// Label describing the [DiagnosticsNode], typically shown before a separator
/// (see [showSeparator]).
///
/// The name will be omitted if the [showName] property is false.
final String? name;
/// Returns a description with a short summary of the node itself not
/// including children or properties.
///
/// `parentConfiguration` specifies how the parent is rendered as text art.
/// For example, if the parent does not line break between properties, the
/// description of a property should also be a single line if possible.
String toDescription({ TextTreeConfiguration? parentConfiguration });
/// Whether to show a separator between [name] and description.
///
/// If false, name and description should be shown with no separation.
/// `:` is typically used as a separator when displaying as text.
final bool showSeparator;
/// Whether the diagnostic should be filtered due to its [level] being lower
/// than `minLevel`.
///
/// If `minLevel` is [DiagnosticLevel.hidden] no diagnostics will be filtered.
/// If `minLevel` is [DiagnosticLevel.off] all diagnostics will be filtered.
bool isFiltered(DiagnosticLevel minLevel) => kReleaseMode || level.index < minLevel.index;
/// Priority level of the diagnostic used to control which diagnostics should
/// be shown and filtered.
///
/// Typically this only makes sense to set to a different value than
/// [DiagnosticLevel.info] for diagnostics representing properties. Some
/// subclasses have a [level] argument to their constructor which influences
/// the value returned here but other factors also influence it. For example,
/// whether an exception is thrown computing a property value
/// [DiagnosticLevel.error] is returned.
DiagnosticLevel get level => kReleaseMode ? DiagnosticLevel.hidden : DiagnosticLevel.info;
/// Whether the name of the property should be shown when showing the default
/// view of the tree.
///
/// This could be set to false (hiding the name) if the value's description
/// will make the name self-evident.
final bool showName;
/// Prefix to include at the start of each line.
final String? linePrefix;
/// Description to show if the node has no displayed properties or children.
String? get emptyBodyDescription => null;
/// The actual object this is diagnostics data for.
Object? get value;
/// Hint for how the node should be displayed.
final DiagnosticsTreeStyle? style;
/// Whether to wrap text on onto multiple lines or not.
bool get allowWrap => false;
/// Whether to wrap the name onto multiple lines or not.
bool get allowNameWrap => false;
/// Whether to allow truncation when displaying the node and its children.
bool get allowTruncate => false;
/// Properties of this [DiagnosticsNode].
///
/// Properties and children are kept distinct even though they are both
/// [List<DiagnosticsNode>] because they should be grouped differently.
List<DiagnosticsNode> getProperties();
/// Children of this [DiagnosticsNode].
///
/// See also:
///
/// * [getProperties], which returns the properties of the [DiagnosticsNode]
/// object.
List<DiagnosticsNode> getChildren();
String get _separator => showSeparator ? ':' : '';
/// Converts the properties ([getProperties]) of this node to a form useful
/// for [Timeline] event arguments (as in [Timeline.startSync]).
///
/// Children ([getChildren]) are omitted.
///
/// This method is only valid in debug builds. In profile builds, this method
/// throws an exception. In release builds it returns null.
///
/// See also:
///
/// * [toJsonMap], which converts this node to a structured form intended for
/// data exchange (e.g. with an IDE).
Map<String, String>? toTimelineArguments() {
if (!kReleaseMode) {
// We don't throw in release builds, to avoid hurting users. We also don't do anything useful.
if (kProfileMode) {
throw FlutterError(
// Parts of this string are searched for verbatim by a test in dev/bots/test.dart.
'$DiagnosticsNode.toTimelineArguments used in non-debug build.\n'
'The $DiagnosticsNode.toTimelineArguments API is expensive and causes timeline traces '
'to be non-representative. As such, it should not be used in profile builds. However, '
'this application is compiled in profile mode and yet still invoked the method.'
);
}
final Map<String, String> result = <String, String>{};
for (final DiagnosticsNode property in getProperties()) {
if (property.name != null) {
result[property.name!] = property.toDescription(parentConfiguration: singleLineTextConfiguration);
}
}
return result;
}
return null;
}
/// Serialize the node to a JSON map according to the configuration provided
/// in the [DiagnosticsSerializationDelegate].
///
/// Subclasses should override if they have additional properties that are
/// useful for the GUI tools that consume this JSON.
///
/// See also:
///
/// * [WidgetInspectorService], which forms the bridge between JSON returned
/// by this method and interactive tree views in the Flutter IntelliJ
/// plugin.
@mustCallSuper
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
Map<String, Object?> result = <String, Object?>{};
assert(() {
final bool hasChildren = getChildren().isNotEmpty;
result = <String, Object?>{
'description': toDescription(),
'type': runtimeType.toString(),
if (name != null)
'name': name,
if (!showSeparator)
'showSeparator': showSeparator,
if (level != DiagnosticLevel.info)
'level': level.name,
if (!showName)
'showName': showName,
if (emptyBodyDescription != null)
'emptyBodyDescription': emptyBodyDescription,
if (style != DiagnosticsTreeStyle.sparse)
'style': style!.name,
if (allowTruncate)
'allowTruncate': allowTruncate,
if (hasChildren)
'hasChildren': hasChildren,
if (linePrefix?.isNotEmpty ?? false)
'linePrefix': linePrefix,
if (!allowWrap)
'allowWrap': allowWrap,
if (allowNameWrap)
'allowNameWrap': allowNameWrap,
...delegate.additionalNodeProperties(this),
if (delegate.includeProperties)
'properties': toJsonList(
delegate.filterProperties(getProperties(), this),
this,
delegate,
),
if (delegate.subtreeDepth > 0)
'children': toJsonList(
delegate.filterChildren(getChildren(), this),
this,
delegate,
),
};
return true;
}());
return result;
}
/// Serializes a [List] of [DiagnosticsNode]s to a JSON list according to
/// the configuration provided by the [DiagnosticsSerializationDelegate].
///
/// The provided `nodes` may be properties or children of the `parent`
/// [DiagnosticsNode].
static List<Map<String, Object?>> toJsonList(
List<DiagnosticsNode>? nodes,
DiagnosticsNode? parent,
DiagnosticsSerializationDelegate delegate,
) {
bool truncated = false;
if (nodes == null) {
return const <Map<String, Object?>>[];
}
final int originalNodeCount = nodes.length;
nodes = delegate.truncateNodesList(nodes, parent);
if (nodes.length != originalNodeCount) {
nodes.add(DiagnosticsNode.message('...'));
truncated = true;
}
final List<Map<String, Object?>> json = nodes.map<Map<String, Object?>>((DiagnosticsNode node) {
return node.toJsonMap(delegate.delegateForNode(node));
}).toList();
if (truncated) {
json.last['truncated'] = true;
}
return json;
}
/// Returns a string representation of this diagnostic that is compatible with
/// the style of the parent if the node is not the root.
///
/// `parentConfiguration` specifies how the parent is rendered as text art.
/// For example, if the parent places all properties on one line, the
/// [toString] for each property should avoid line breaks if possible.
///
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// In release mode, far less information is retained and some information may
/// not print at all.
@override
String toString({
TextTreeConfiguration? parentConfiguration,
DiagnosticLevel minLevel = DiagnosticLevel.info,
}) {
String result = super.toString();
assert(style != null);
assert(() {
if (_isSingleLine(style)) {
result = toStringDeep(parentConfiguration: parentConfiguration, minLevel: minLevel);
} else {
final String description = toDescription(parentConfiguration: parentConfiguration);
if (name == null || name!.isEmpty || !showName) {
result = description;
} else {
result = description.contains('\n') ? '$name$_separator\n$description'
: '$name$_separator $description';
}
}
return true;
}());
return result;
}
/// Returns a configuration specifying how this object should be rendered
/// as text art.
@protected
TextTreeConfiguration? get textTreeConfiguration {
assert(style != null);
return switch (style!) {
DiagnosticsTreeStyle.none => null,
DiagnosticsTreeStyle.dense => denseTextConfiguration,
DiagnosticsTreeStyle.sparse => sparseTextConfiguration,
DiagnosticsTreeStyle.offstage => dashedTextConfiguration,
DiagnosticsTreeStyle.whitespace => whitespaceTextConfiguration,
DiagnosticsTreeStyle.transition => transitionTextConfiguration,
DiagnosticsTreeStyle.singleLine => singleLineTextConfiguration,
DiagnosticsTreeStyle.errorProperty => errorPropertyTextConfiguration,
DiagnosticsTreeStyle.shallow => shallowTextConfiguration,
DiagnosticsTreeStyle.error => errorTextConfiguration,
DiagnosticsTreeStyle.flat => flatTextConfiguration,
// Truncate children doesn't really need its own text style as the
// rendering is quite custom.
DiagnosticsTreeStyle.truncateChildren => whitespaceTextConfiguration,
};
}
/// Returns a string representation of this node and its descendants.
///
/// `prefixLineOne` will be added to the front of the first line of the
/// output. `prefixOtherLines` will be added to the front of each other line.
/// If `prefixOtherLines` is null, the `prefixLineOne` is used for every line.
/// By default, there is no prefix.
///
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// The [toStringDeep] method takes other arguments, but those are intended
/// for internal use when recursing to the descendants, and so can be ignored.
///
/// In release mode, far less information is retained and some information may
/// not print at all.
///
/// See also:
///
/// * [toString], for a brief description of the [value] but not its
/// children.
String toStringDeep({
String prefixLineOne = '',
String? prefixOtherLines,
TextTreeConfiguration? parentConfiguration,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
String result = '';
assert(() {
result = TextTreeRenderer(
minLevel: minLevel,
wrapWidth: 65,
).render(
this,
prefixLineOne: prefixLineOne,
prefixOtherLines: prefixOtherLines,
parentConfiguration: parentConfiguration,
);
return true;
}());
return result;
}
}
/// Debugging message displayed like a property.
///
/// {@tool snippet}
///
/// The following two properties are better expressed using this
/// [MessageProperty] class, rather than [StringProperty], as the intent is to
/// show a message with property style display rather than to describe the value
/// of an actual property of the object:
///
/// ```dart
/// MessageProperty table = MessageProperty('table size', '$columns\u00D7$rows');
/// MessageProperty usefulness = MessageProperty('usefulness ratio', 'no metrics collected yet (never painted)');
/// ```
/// {@end-tool}
/// {@tool snippet}
///
/// On the other hand, [StringProperty] is better suited when the property has a
/// concrete value that is a string:
///
/// ```dart
/// StringProperty name = StringProperty('name', _name);
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [DiagnosticsNode.message], which serves the same role for messages
/// without a clear property name.
/// * [StringProperty], which is a better fit for properties with string values.
class MessageProperty extends DiagnosticsProperty<void> {
/// Create a diagnostics property that displays a message.
///
/// Messages have no concrete [value] (so [value] will return null). The
/// message is stored as the description.
MessageProperty(
String name,
String message, {
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info,
}) : super(name, null, description: message, style: style, level: level);
}
/// Property which encloses its string [value] in quotes.
///
/// See also:
///
/// * [MessageProperty], which is a better fit for showing a message
/// instead of describing a property with a string value.
class StringProperty extends DiagnosticsProperty<String> {
/// Create a diagnostics property for strings.
StringProperty(
String super.name,
super.value, {
super.description,
super.tooltip,
super.showName,
super.defaultValue,
this.quoted = true,
super.ifEmpty,
super.style,
super.level,
});
/// Whether the value is enclosed in double quotes.
final bool quoted;
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
json['quoted'] = quoted;
return json;
}
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
String? text = _description ?? value;
if (parentConfiguration != null &&
!parentConfiguration.lineBreakProperties &&
text != null) {
// Escape linebreaks in multiline strings to avoid confusing output when
// the parent of this node is trying to display all properties on the same
// line.
text = text.replaceAll('\n', r'\n');
}
if (quoted && text != null) {
// An empty value would not appear empty after being surrounded with
// quotes so we have to handle this case separately.
if (ifEmpty != null && text.isEmpty) {
return ifEmpty!;
}
return '"$text"';
}
return text.toString();
}
}
abstract class _NumProperty<T extends num> extends DiagnosticsProperty<T> {
_NumProperty(
String super.name,
super.value, {
super.ifNull,
this.unit,
super.showName,
super.defaultValue,
super.tooltip,
super.style,
super.level,
});
_NumProperty.lazy(
String super.name,
super.computeValue, {
super.ifNull,
this.unit,
super.showName,
super.defaultValue,
super.tooltip,
super.style,
super.level,
}) : super.lazy();
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
if (unit != null) {
json['unit'] = unit;
}
json['numberToString'] = numberToString();
return json;
}
/// Optional unit the [value] is measured in.
///
/// Unit must be acceptable to display immediately after a number with no
/// spaces. For example: 'physical pixels per logical pixel' should be a
/// [tooltip] not a [unit].
final String? unit;
/// String describing just the numeric [value] without a unit suffix.
String numberToString();
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
if (value == null) {
return value.toString();
}
return unit != null ? '${numberToString()}$unit' : numberToString();
}
}
/// Property describing a [double] [value] with an optional [unit] of measurement.
///
/// Numeric formatting is optimized for debug message readability.
class DoubleProperty extends _NumProperty<double> {
/// If specified, [unit] describes the unit for the [value] (e.g. px).
DoubleProperty(
super.name,
super.value, {
super.ifNull,
super.unit,
super.tooltip,
super.defaultValue,
super.showName,
super.style,
super.level,
});
/// Property with a [value] that is computed only when needed.
///
/// Use if computing the property [value] may throw an exception or is
/// expensive.
DoubleProperty.lazy(
super.name,
super.computeValue, {
super.ifNull,
super.showName,
super.unit,
super.tooltip,
super.defaultValue,
super.level,
}) : super.lazy();
@override
String numberToString() => debugFormatDouble(value);
}
/// An int valued property with an optional unit the value is measured in.
///
/// Examples of units include 'px' and 'ms'.
class IntProperty extends _NumProperty<int> {
/// Create a diagnostics property for integers.
IntProperty(
super.name,
super.value, {
super.ifNull,
super.showName,
super.unit,
super.defaultValue,
super.style,
super.level,
});
@override
String numberToString() => value.toString();
}
/// Property which clamps a [double] to between 0 and 1 and formats it as a
/// percentage.
class PercentProperty extends DoubleProperty {
/// Create a diagnostics property for doubles that represent percentages or
/// fractions.
///
/// Setting [showName] to false is often reasonable for [PercentProperty]
/// objects, as the fact that the property is shown as a percentage tends to
/// be sufficient to disambiguate its meaning.
PercentProperty(
super.name,
super.fraction, {
super.ifNull,
super.showName,
super.tooltip,
super.unit,
super.level,
});
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
if (value == null) {
return value.toString();
}
return unit != null ? '${numberToString()} $unit' : numberToString();
}
@override
String numberToString() {
final double? v = value;
if (v == null) {
return value.toString();
}
return '${(clampDouble(v, 0.0, 1.0) * 100.0).toStringAsFixed(1)}%';
}
}
/// Property where the description is either [ifTrue] or [ifFalse] depending on
/// whether [value] is true or false.
///
/// Using [FlagProperty] instead of [DiagnosticsProperty<bool>] can make
/// diagnostics display more polished. For example, given a property named
/// `visible` that is typically true, the following code will return 'hidden'
/// when `visible` is false and nothing when visible is true, in contrast to
/// `visible: true` or `visible: false`.
///
/// {@tool snippet}
///
/// ```dart
/// FlagProperty(
/// 'visible',
/// value: true,
/// ifFalse: 'hidden',
/// )
/// ```
/// {@end-tool}
/// {@tool snippet}
///
/// [FlagProperty] should also be used instead of [DiagnosticsProperty<bool>]
/// if showing the bool value would not clearly indicate the meaning of the
/// property value.
///
/// ```dart
/// FlagProperty(
/// 'inherit',
/// value: inherit,
/// ifTrue: '<all styles inherited>',
/// ifFalse: '<no style specified>',
/// )
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [ObjectFlagProperty], which provides similar behavior describing whether
/// a [value] is null.
class FlagProperty extends DiagnosticsProperty<bool> {
/// Constructs a FlagProperty with the given descriptions with the specified descriptions.
///
/// [showName] defaults to false as typically [ifTrue] and [ifFalse] should
/// be descriptions that make the property name redundant.
FlagProperty(
String name, {
required bool? value,
this.ifTrue,
this.ifFalse,
bool showName = false,
Object? defaultValue,
DiagnosticLevel level = DiagnosticLevel.info,
}) : assert(ifTrue != null || ifFalse != null),
super(
name,
value,
showName: showName,
defaultValue: defaultValue,
level: level,
);
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
if (ifTrue != null) {
json['ifTrue'] = ifTrue;
}
if (ifFalse != null) {
json['ifFalse'] = ifFalse;
}
return json;
}
/// Description to use if the property [value] is true.
///
/// If not specified and [value] equals true the property's priority [level]
/// will be [DiagnosticLevel.hidden].
final String? ifTrue;
/// Description to use if the property value is false.
///
/// If not specified and [value] equals false, the property's priority [level]
/// will be [DiagnosticLevel.hidden].
final String? ifFalse;
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
if (value ?? false) {
if (ifTrue != null) {
return ifTrue!;
}
} else if (value == false) {
if (ifFalse != null) {
return ifFalse!;
}
}
return super.valueToString(parentConfiguration: parentConfiguration);
}
@override
bool get showName {
if (value == null || ((value ?? false) && ifTrue == null) || (!(value ?? true) && ifFalse == null)) {
// We are missing a description for the flag value so we need to show the
// flag name. The property will have DiagnosticLevel.hidden for this case
// so users will not see this property in this case unless they are
// displaying hidden properties.
return true;
}
return super.showName;
}
@override
DiagnosticLevel get level {
if (value ?? false) {
if (ifTrue == null) {
return DiagnosticLevel.hidden;
}
}
if (value == false) {
if (ifFalse == null) {
return DiagnosticLevel.hidden;
}
}
return super.level;
}
}
/// Property with an `Iterable<T>` [value] that can be displayed with
/// different [DiagnosticsTreeStyle] for custom rendering.
///
/// If [style] is [DiagnosticsTreeStyle.singleLine], the iterable is described
/// as a comma separated list, otherwise the iterable is described as a line
/// break separated list.
class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
/// Create a diagnostics property for iterables (e.g. lists).
///
/// The [ifEmpty] argument is used to indicate how an iterable [value] with 0
/// elements is displayed. If [ifEmpty] equals null that indicates that an
/// empty iterable [value] is not interesting to display similar to how
/// [defaultValue] is used to indicate that a specific concrete value is not
/// interesting to display.
IterableProperty(
String super.name,
super.value, {
super.defaultValue,
super.ifNull,
super.ifEmpty = '[]',
super.style,
super.showName,
super.showSeparator,
super.level,
});
@override
String valueToString({TextTreeConfiguration? parentConfiguration}) {
if (value == null) {
return value.toString();
}
if (value!.isEmpty) {
return ifEmpty ?? '[]';
}
final Iterable<String> formattedValues = value!.map((T v) {
if (T == double && v is double) {
return debugFormatDouble(v);
} else {
return v.toString();
}
});
if (parentConfiguration != null && !parentConfiguration.lineBreakProperties) {
// Always display the value as a single line and enclose the iterable
// value in brackets to avoid ambiguity.
return '[${formattedValues.join(', ')}]';
}
return formattedValues.join(_isSingleLine(style) ? ', ' : '\n');
}
/// Priority level of the diagnostic used to control which diagnostics should
/// be shown and filtered.
///
/// If [ifEmpty] is null and the [value] is an empty [Iterable] then level
/// [DiagnosticLevel.fine] is returned in a similar way to how an
/// [ObjectFlagProperty] handles when [ifNull] is null and the [value] is
/// null.
@override
DiagnosticLevel get level {
if (ifEmpty == null && value != null && value!.isEmpty && super.level != DiagnosticLevel.hidden) {
return DiagnosticLevel.fine;
}
return super.level;
}
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
if (value != null) {
json['values'] = value!.map<String>((T value) => value.toString()).toList();
}
return json;
}
}
/// [DiagnosticsProperty] that has an [Enum] as value.
///
/// The enum value is displayed with the enum name stripped. For example:
/// [HitTestBehavior.deferToChild] is shown as `deferToChild`.
///
/// This class can be used with enums and returns the enum's name getter. It
/// can also be used with nullable properties; the null value is represented as
/// `null`.
///
/// See also:
///
/// * [DiagnosticsProperty] which documents named parameters common to all
/// [DiagnosticsProperty].
class EnumProperty<T extends Enum?> extends DiagnosticsProperty<T> {
/// Create a diagnostics property that displays an enum.
///
/// The [level] argument must also not be null.
EnumProperty(
String super.name,
super.value, {
super.defaultValue,
super.level,
});
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
return value?.name ?? 'null';
}
}
/// A property where the important diagnostic information is primarily whether
/// the [value] is present (non-null) or absent (null), rather than the actual
/// value of the property itself.
///
/// The [ifPresent] and [ifNull] strings describe the property [value] when it
/// is non-null and null respectively. If one of [ifPresent] or [ifNull] is
/// omitted, that is taken to mean that [level] should be
/// [DiagnosticLevel.hidden] when [value] is non-null or null respectively.
///
/// This kind of diagnostics property is typically used for opaque
/// values, like closures, where presenting the actual object is of dubious
/// value but where reporting the presence or absence of the value is much more
/// useful.
///
/// See also:
///
///
/// * [FlagsSummary], which provides similar functionality but accepts multiple
/// flags under the same name, and is preferred if there are multiple such
/// values that can fit into a same category (such as "listeners").
/// * [FlagProperty], which provides similar functionality describing whether
/// a [value] is true or false.
class ObjectFlagProperty<T> extends DiagnosticsProperty<T> {
/// Create a diagnostics property for values that can be present (non-null) or
/// absent (null), but for which the exact value's [Object.toString]
/// representation is not very transparent (e.g. a callback).
///
/// At least one of [ifPresent] or [ifNull] must be non-null.
ObjectFlagProperty(
String super.name,
super.value, {
this.ifPresent,
super.ifNull,
super.showName = false,
super.level,
}) : assert(ifPresent != null || ifNull != null);
/// Shorthand constructor to describe whether the property has a value.
///
/// Only use if prefixing the property name with the word 'has' is a good
/// flag name.
ObjectFlagProperty.has(
String super.name,
super.value, {
super.level,
}) : ifPresent = 'has $name',
super(
showName: false,
);
/// Description to use if the property [value] is not null.
///
/// If the property [value] is not null and [ifPresent] is null, the
/// [level] for the property is [DiagnosticLevel.hidden] and the description
/// from superclass is used.
final String? ifPresent;
@override
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
if (value != null) {
if (ifPresent != null) {
return ifPresent!;
}
} else {
if (ifNull != null) {
return ifNull!;
}
}
return super.valueToString(parentConfiguration: parentConfiguration);
}
@override
bool get showName {
if ((value != null && ifPresent == null) || (value == null && ifNull == null)) {
// We are missing a description for the flag value so we need to show the
// flag name. The property will have DiagnosticLevel.hidden for this case
// so users will not see this property in this case unless they are
// displaying hidden properties.
return true;
}
return super.showName;
}
@override
DiagnosticLevel get level {
if (value != null) {
if (ifPresent == null) {
return DiagnosticLevel.hidden;
}
} else {
if (ifNull == null) {
return DiagnosticLevel.hidden;
}
}
return super.level;
}
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
if (ifPresent != null) {
json['ifPresent'] = ifPresent;
}
return json;
}
}
/// A summary of multiple properties, indicating whether each of them is present
/// (non-null) or absent (null).
///
/// Each entry of [value] is described by its key. The eventual description will
/// be a list of keys of non-null entries.
///
/// The [ifEmpty] describes the entire collection of [value] when it contains no
/// non-null entries. If [ifEmpty] is omitted, [level] will be
/// [DiagnosticLevel.hidden] when [value] contains no non-null entries.
///
/// This kind of diagnostics property is typically used for opaque
/// values, like closures, where presenting the actual object is of dubious
/// value but where reporting the presence or absence of the value is much more
/// useful.
///
/// See also:
///
/// * [ObjectFlagProperty], which provides similar functionality but accepts
/// only one flag, and is preferred if there is only one entry.
/// * [IterableProperty], which provides similar functionality describing
/// the values a collection of objects.
class FlagsSummary<T> extends DiagnosticsProperty<Map<String, T?>> {
/// Create a summary for multiple properties, indicating whether each of them
/// is present (non-null) or absent (null).
///
/// The [value], [showName], [showSeparator] and [level] arguments must not be
/// null.
FlagsSummary(
String super.name,
Map<String, T?> super.value, {
super.ifEmpty,
super.showName,
super.showSeparator,
super.level,
});
@override
Map<String, T?> get value => super.value!;
@override
String valueToString({TextTreeConfiguration? parentConfiguration}) {
if (!_hasNonNullEntry() && ifEmpty != null) {
return ifEmpty!;
}
final Iterable<String> formattedValues = _formattedValues();
if (parentConfiguration != null && !parentConfiguration.lineBreakProperties) {
// Always display the value as a single line and enclose the iterable
// value in brackets to avoid ambiguity.
return '[${formattedValues.join(', ')}]';
}
return formattedValues.join(_isSingleLine(style) ? ', ' : '\n');
}
/// Priority level of the diagnostic used to control which diagnostics should
/// be shown and filtered.
///
/// If [ifEmpty] is null and the [value] contains no non-null entries, then
/// level [DiagnosticLevel.hidden] is returned.
@override
DiagnosticLevel get level {
if (!_hasNonNullEntry() && ifEmpty == null) {
return DiagnosticLevel.hidden;
}
return super.level;
}
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final Map<String, Object?> json = super.toJsonMap(delegate);
if (value.isNotEmpty) {
json['values'] = _formattedValues().toList();
}
return json;
}
bool _hasNonNullEntry() => value.values.any((T? o) => o != null);
// An iterable of each entry's description in [value].
//
// For a non-null value, its description is its key.
//
// For a null value, it is omitted unless `includeEmpty` is true and
// [ifEntryNull] contains a corresponding description.
Iterable<String> _formattedValues() {
return value.entries
.where((MapEntry<String, T?> entry) => entry.value != null)
.map((MapEntry<String, T?> entry) => entry.key);
}
}
/// Signature for computing the value of a property.
///
/// May throw exception if accessing the property would throw an exception
/// and callers must handle that case gracefully. For example, accessing a
/// property may trigger an assert that layout constraints were violated.
typedef ComputePropertyValueCallback<T> = T? Function();
/// Property with a [value] of type [T].
///
/// If the default `value.toString()` does not provide an adequate description
/// of the value, specify `description` defining a custom description.
///
/// The [showSeparator] property indicates whether a separator should be placed
/// between the property [name] and its [value].
class DiagnosticsProperty<T> extends DiagnosticsNode {
/// Create a diagnostics property.
///
/// The [level] argument is just a suggestion and can be overridden if
/// something else about the property causes it to have a lower or higher
/// level. For example, if the property value is null and [missingIfNull] is
/// true, [level] is raised to [DiagnosticLevel.warning].
DiagnosticsProperty(
String? name,
T? value, {
String? description,
String? ifNull,
this.ifEmpty,
super.showName,
super.showSeparator,
this.defaultValue = kNoDefaultValue,
this.tooltip,
this.missingIfNull = false,
super.linePrefix,
this.expandableValue = false,
this.allowWrap = true,
this.allowNameWrap = true,
DiagnosticsTreeStyle super.style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info,
}) : _description = description,
_valueComputed = true,
_value = value,
_computeValue = null,
ifNull = ifNull ?? (missingIfNull ? 'MISSING' : null),
_defaultLevel = level,
super(
name: name,
);
/// Property with a [value] that is computed only when needed.
///
/// Use if computing the property [value] may throw an exception or is
/// expensive.
///
/// The [level] argument is just a suggestion and can be overridden
/// if something else about the property causes it to have a lower or higher
/// level. For example, if calling `computeValue` throws an exception, [level]
/// will always return [DiagnosticLevel.error].
DiagnosticsProperty.lazy(
String? name,
ComputePropertyValueCallback<T> computeValue, {
String? description,
String? ifNull,
this.ifEmpty,
super.showName,
super.showSeparator,
this.defaultValue = kNoDefaultValue,
this.tooltip,
this.missingIfNull = false,
this.expandableValue = false,
this.allowWrap = true,
this.allowNameWrap = true,
DiagnosticsTreeStyle super.style = DiagnosticsTreeStyle.singleLine,
DiagnosticLevel level = DiagnosticLevel.info,
}) : assert(defaultValue == kNoDefaultValue || defaultValue is T?),
_description = description,
_valueComputed = false,
_value = null,
_computeValue = computeValue,
_defaultLevel = level,
ifNull = ifNull ?? (missingIfNull ? 'MISSING' : null),
super(
name: name,
);
final String? _description;
/// Whether to expose properties and children of the value as properties and
/// children.
final bool expandableValue;
@override
final bool allowWrap;
@override
final bool allowNameWrap;
@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
final T? v = value;
List<Map<String, Object?>>? properties;
if (delegate.expandPropertyValues && delegate.includeProperties && v is Diagnosticable && getProperties().isEmpty) {
// Exclude children for expanded nodes to avoid cycles.
delegate = delegate.copyWith(subtreeDepth: 0, includeProperties: false);
properties = DiagnosticsNode.toJsonList(
delegate.filterProperties(v.toDiagnosticsNode().getProperties(), this),
this,
delegate,
);
}
final Map<String, Object?> json = super.toJsonMap(delegate);
if (properties != null) {
json['properties'] = properties;
}
if (defaultValue != kNoDefaultValue) {
json['defaultValue'] = defaultValue.toString();
}
if (ifEmpty != null) {
json['ifEmpty'] = ifEmpty;
}
if (ifNull != null) {
json['ifNull'] = ifNull;
}
if (tooltip != null) {
json['tooltip'] = tooltip;
}
json['missingIfNull'] = missingIfNull;
if (exception != null) {
json['exception'] = exception.toString();
}
json['propertyType'] = propertyType.toString();
json['defaultLevel'] = _defaultLevel.name;
if (value is Diagnosticable || value is DiagnosticsNode) {
json['isDiagnosticableValue'] = true;
}
if (v is num) {
// TODO(jacob314): Workaround, since JSON.stringify replaces infinity and NaN with null,
// https://github.com/flutter/flutter/issues/39937#issuecomment-529558033)
json['value'] = v.isFinite ? v : v.toString();
}
if (value is String || value is bool || value == null) {
json['value'] = value;
}
return json;
}
/// Returns a string representation of the property value.
///
/// Subclasses should override this method instead of [toDescription] to
/// customize how property values are converted to strings.
///
/// Overriding this method ensures that behavior controlling how property
/// values are decorated to generate a nice [toDescription] are consistent
/// across all implementations. Debugging tools may also choose to use
/// [valueToString] directly instead of [toDescription].
///
/// `parentConfiguration` specifies how the parent is rendered as text art.
/// For example, if the parent places all properties on one line, the value
/// of the property should be displayed without line breaks if possible.
String valueToString({ TextTreeConfiguration? parentConfiguration }) {
final T? v = value;
// DiagnosticableTree values are shown using the shorter toStringShort()
// instead of the longer toString() because the toString() for a
// DiagnosticableTree value is likely too large to be useful.
return v is DiagnosticableTree ? v.toStringShort() : v.toString();
}
@override
String toDescription({ TextTreeConfiguration? parentConfiguration }) {
if (_description != null) {
return _addTooltip(_description);
}
if (exception != null) {
return 'EXCEPTION (${exception.runtimeType})';
}
if (ifNull != null && value == null) {
return _addTooltip(ifNull!);
}
String result = valueToString(parentConfiguration: parentConfiguration);
if (result.isEmpty && ifEmpty != null) {
result = ifEmpty!;
}
return _addTooltip(result);
}
/// If a [tooltip] is specified, add the tooltip it to the end of `text`
/// enclosing it parenthesis to disambiguate the tooltip from the rest of
/// the text.
String _addTooltip(String text) {
return tooltip == null ? text : '$text ($tooltip)';
}
/// Description if the property [value] is null.
final String? ifNull;
/// Description if the property description would otherwise be empty.
final String? ifEmpty;
/// Optional tooltip typically describing the property.
///
/// Example tooltip: 'physical pixels per logical pixel'
///
/// If present, the tooltip is added in parenthesis after the raw value when
/// generating the string description.
final String? tooltip;
/// Whether a [value] of null causes the property to have [level]
/// [DiagnosticLevel.warning] warning that the property is missing a [value].
final bool missingIfNull;
/// The type of the property [value].
///
/// This is determined from the type argument `T` used to instantiate the
/// [DiagnosticsProperty] class. This means that the type is available even if
/// [value] is null, but it also means that the [propertyType] is only as
/// accurate as the type provided when invoking the constructor.
///
/// Generally, this is only useful for diagnostic tools that should display
/// null values in a manner consistent with the property type. For example, a
/// tool might display a null [Color] value as an empty rectangle instead of
/// the word "null".
Type get propertyType => T;
/// Returns the value of the property either from cache or by invoking a
/// [ComputePropertyValueCallback].
///
/// If an exception is thrown invoking the [ComputePropertyValueCallback],
/// [value] returns null and the exception thrown can be found via the
/// [exception] property.
///
/// See also:
///
/// * [valueToString], which converts the property value to a string.
@override
T? get value {
_maybeCacheValue();
return _value;
}
T? _value;
bool _valueComputed;
Object? _exception;
/// Exception thrown if accessing the property [value] threw an exception.
///
/// Returns null if computing the property value did not throw an exception.
Object? get exception {
_maybeCacheValue();
return _exception;
}
void _maybeCacheValue() {
if (_valueComputed) {
return;
}
_valueComputed = true;
assert(_computeValue != null);
try {
_value = _computeValue!();
} catch (exception) {
// The error is reported to inspector; rethrowing would destroy the
// debugging experience.
_exception = exception;
_value = null;
}
}
/// The default value of this property, when it has not been set to a specific
/// value.
///
/// For most [DiagnosticsProperty] classes, if the [value] of the property
/// equals [defaultValue], then the priority [level] of the property is
/// downgraded to [DiagnosticLevel.fine] on the basis that the property value
/// is uninteresting. This is implemented by [isInteresting].
///
/// The [defaultValue] is [kNoDefaultValue] by default. Otherwise it must be of
/// type `T?`.
final Object? defaultValue;
/// Whether to consider the property's value interesting. When a property is
/// uninteresting, its [level] is downgraded to [DiagnosticLevel.fine]
/// regardless of the value provided as the constructor's `level` argument.
bool get isInteresting => defaultValue == kNoDefaultValue || value != defaultValue;
final DiagnosticLevel _defaultLevel;
/// Priority level of the diagnostic used to control which diagnostics should
/// be shown and filtered.
///
/// The property level defaults to the value specified by the [level]
/// constructor argument. The level is raised to [DiagnosticLevel.error] if
/// an [exception] was thrown getting the property [value]. The level is
/// raised to [DiagnosticLevel.warning] if the property [value] is null and
/// the property is not allowed to be null due to [missingIfNull]. The
/// priority level is lowered to [DiagnosticLevel.fine] if the property
/// [value] equals [defaultValue].
@override
DiagnosticLevel get level {
if (_defaultLevel == DiagnosticLevel.hidden) {
return _defaultLevel;
}
if (exception != null) {
return DiagnosticLevel.error;
}
if (value == null && missingIfNull) {
return DiagnosticLevel.warning;
}
if (!isInteresting) {
return DiagnosticLevel.fine;
}
return _defaultLevel;
}
final ComputePropertyValueCallback<T>? _computeValue;
@override
List<DiagnosticsNode> getProperties() {
if (expandableValue) {
final T? object = value;
if (object is DiagnosticsNode) {
return object.getProperties();
}
if (object is Diagnosticable) {
return object.toDiagnosticsNode(style: style).getProperties();
}
}
return const <DiagnosticsNode>[];
}
@override
List<DiagnosticsNode> getChildren() {
if (expandableValue) {
final T? object = value;
if (object is DiagnosticsNode) {
return object.getChildren();
}
if (object is Diagnosticable) {
return object.toDiagnosticsNode(style: style).getChildren();
}
}
return const <DiagnosticsNode>[];
}
}
/// [DiagnosticsNode] that lazily calls the associated [Diagnosticable] [value]
/// to implement [getChildren] and [getProperties].
class DiagnosticableNode<T extends Diagnosticable> extends DiagnosticsNode {
/// Create a diagnostics describing a [Diagnosticable] value.
DiagnosticableNode({
super.name,
required this.value,
required super.style,
});
@override
final T value;
DiagnosticPropertiesBuilder? _cachedBuilder;
/// Retrieve the [DiagnosticPropertiesBuilder] of current node.
///
/// It will cache the result to prevent duplicate operation.
DiagnosticPropertiesBuilder? get builder {
if (kReleaseMode) {
return null;
} else {
assert(() {
if (_cachedBuilder == null) {
_cachedBuilder = DiagnosticPropertiesBuilder();
value.debugFillProperties(_cachedBuilder!);
}
return true;
}());
return _cachedBuilder;
}
}
@override
DiagnosticsTreeStyle get style {
return kReleaseMode ? DiagnosticsTreeStyle.none : super.style ?? builder!.defaultDiagnosticsTreeStyle;
}
@override
String? get emptyBodyDescription => (kReleaseMode || kProfileMode) ? '' : builder!.emptyBodyDescription;
@override
List<DiagnosticsNode> getProperties() => (kReleaseMode || kProfileMode) ? const <DiagnosticsNode>[] : builder!.properties;
@override
List<DiagnosticsNode> getChildren() {
return const<DiagnosticsNode>[];
}
@override
String toDescription({ TextTreeConfiguration? parentConfiguration }) {
String result = '';
assert(() {
result = value.toStringShort();
return true;
}());
return result;
}
}
/// [DiagnosticsNode] for an instance of [DiagnosticableTree].
class DiagnosticableTreeNode extends DiagnosticableNode<DiagnosticableTree> {
/// Creates a [DiagnosticableTreeNode].
DiagnosticableTreeNode({
super.name,
required super.value,
required super.style,
});
@override
List<DiagnosticsNode> getChildren() => value.debugDescribeChildren();
}
/// Returns a 5 character long hexadecimal string generated from
/// [Object.hashCode]'s 20 least-significant bits.
String shortHash(Object? object) {
return object.hashCode.toUnsigned(20).toRadixString(16).padLeft(5, '0');
}
/// Returns a summary of the runtime type and hash code of `object`.
///
/// See also:
///
/// * [Object.hashCode], a value used when placing an object in a [Map] or
/// other similar data structure, and which is also used in debug output to
/// distinguish instances of the same class (hash collisions are
/// possible, but rare enough that its use in debug output is useful).
/// * [Object.runtimeType], the [Type] of an object.
String describeIdentity(Object? object) => '${objectRuntimeType(object, '<optimized out>')}#${shortHash(object)}';
/// Returns a short description of an enum value.
///
/// Strips off the enum class name from the `enumEntry.toString()`.
///
/// For real enums, this is redundant with calling the `name` getter on the enum
/// value (see [EnumName.name]), a feature that was added to Dart 2.15.
///
/// This function can also be used with classes whose `toString` return a value
/// in the same form as an enum (the class name, a dot, then the value name).
/// For example, it's used with [SemanticsAction], which is written to appear to
/// be an enum but is actually a bespoke class so that the index values can be
/// set as powers of two instead of as sequential integers.
///
/// {@tool snippet}
///
/// ```dart
/// enum Day {
/// monday, tuesday, wednesday, thursday, friday, saturday, sunday
/// }
///
/// void validateDescribeEnum() {
/// assert(Day.monday.toString() == 'Day.monday');
/// assert(describeEnum(Day.monday) == 'monday');
/// assert(Day.monday.name == 'monday'); // preferred for real enums
/// }
/// ```
/// {@end-tool}
@Deprecated(
'Use the `name` getter on enums instead. '
'This feature was deprecated after v3.14.0-2.0.pre.'
)
String describeEnum(Object enumEntry) {
if (enumEntry is Enum) {
return enumEntry.name;
}
final String description = enumEntry.toString();
final int indexOfDot = description.indexOf('.');
assert(
indexOfDot != -1 && indexOfDot < description.length - 1,
'The provided object "$enumEntry" is not an enum.',
);
return description.substring(indexOfDot + 1);
}
/// Builder to accumulate properties and configuration used to assemble a
/// [DiagnosticsNode] from a [Diagnosticable] object.
class DiagnosticPropertiesBuilder {
/// Creates a [DiagnosticPropertiesBuilder] with [properties] initialize to
/// an empty array.
DiagnosticPropertiesBuilder() : properties = <DiagnosticsNode>[];
/// Creates a [DiagnosticPropertiesBuilder] with a given [properties].
DiagnosticPropertiesBuilder.fromProperties(this.properties);
/// Add a property to the list of properties.
void add(DiagnosticsNode property) {
assert(() {
properties.add(property);
return true;
}());
}
/// List of properties accumulated so far.
final List<DiagnosticsNode> properties;
/// Default style to use for the [DiagnosticsNode] if no style is specified.
DiagnosticsTreeStyle defaultDiagnosticsTreeStyle = DiagnosticsTreeStyle.sparse;
/// Description to show if the node has no displayed properties or children.
String? emptyBodyDescription;
}
// Examples can assume:
// class ExampleSuperclass with Diagnosticable { late String message; late double stepWidth; late double scale; late double paintExtent; late double hitTestExtent; late double paintExtend; late double maxWidth; late bool primary; late double progress; late int maxLines; late Duration duration; late int depth; Iterable<BoxShadow>? boxShadow; late DiagnosticsTreeStyle style; late bool hasSize; late Matrix4 transform; Map<Listenable, VoidCallback>? handles; late Color color; late bool obscureText; late ImageRepeat repeat; late Size size; late Widget widget; late bool isCurrent; late bool keepAlive; late TextAlign textAlign; }
/// A mixin class for providing string and [DiagnosticsNode] debug
/// representations describing the properties of an object.
///
/// The string debug representation is generated from the intermediate
/// [DiagnosticsNode] representation. The [DiagnosticsNode] representation is
/// also used by debugging tools displaying interactive trees of objects and
/// properties.
///
/// See also:
///
/// * [debugFillProperties], which lists best practices for specifying the
/// properties of a [DiagnosticsNode]. The most common use case is to
/// override [debugFillProperties] defining custom properties for a subclass
/// of [DiagnosticableTreeMixin] using the existing [DiagnosticsProperty]
/// subclasses.
/// * [DiagnosticableTree], which extends this class to also describe the
/// children of a tree structured object.
/// * [DiagnosticableTree.debugDescribeChildren], which lists best practices
/// for describing the children of a [DiagnosticsNode]. Typically the base
/// class already describes the children of a node properly or a node has
/// no children.
/// * [DiagnosticsProperty], which should be used to create leaf diagnostic
/// nodes without properties or children. There are many
/// [DiagnosticsProperty] subclasses to handle common use cases.
mixin Diagnosticable {
/// A brief description of this object, usually just the [runtimeType] and the
/// [hashCode].
///
/// See also:
///
/// * [toString], for a detailed description of the object.
String toStringShort() => describeIdentity(this);
@override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
String? fullString;
assert(() {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel);
return true;
}());
return fullString ?? toStringShort();
}
/// Returns a debug representation of the object that is used by debugging
/// tools and by [DiagnosticsNode.toStringDeep].
///
/// Leave [name] as null if there is not a meaningful description of the
/// relationship between the this node and its parent.
///
/// Typically the [style] argument is only specified to indicate an atypical
/// relationship between the parent and the node. For example, pass
/// [DiagnosticsTreeStyle.offstage] to indicate that a node is offstage.
DiagnosticsNode toDiagnosticsNode({ String? name, DiagnosticsTreeStyle? style }) {
return DiagnosticableNode<Diagnosticable>(
name: name,
value: this,
style: style,
);
}
/// Add additional properties associated with the node.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=DnC7eT-vh1k}
///
/// Use the most specific [DiagnosticsProperty] existing subclass to describe
/// each property instead of the [DiagnosticsProperty] base class. There are
/// only a small number of [DiagnosticsProperty] subclasses each covering a
/// common use case. Consider what values a property is relevant for users
/// debugging as users debugging large trees are overloaded with information.
/// Common named parameters in [DiagnosticsNode] subclasses help filter when
/// and how properties are displayed.
///
/// `defaultValue`, `showName`, `showSeparator`, and `level` keep string
/// representations of diagnostics terse and hide properties when they are not
/// very useful.
///
/// * Use `defaultValue` any time the default value of a property is
/// uninteresting. For example, specify a default value of null any time
/// a property being null does not indicate an error.
/// * Avoid specifying the `level` parameter unless the result you want
/// cannot be achieved by using the `defaultValue` parameter or using
/// the [ObjectFlagProperty] class to conditionally display the property
/// as a flag.
/// * Specify `showName` and `showSeparator` in rare cases where the string
/// output would look clumsy if they were not set.
/// ```dart
/// DiagnosticsProperty<Object>('child(3, 4)', null, ifNull: 'is null', showSeparator: false).toString()
/// ```
/// Shows using `showSeparator` to get output `child(3, 4) is null` which
/// is more polished than `child(3, 4): is null`.
/// ```dart
/// DiagnosticsProperty<IconData>('icon', icon, ifNull: '<empty>', showName: false).toString()
/// ```
/// Shows using `showName` to omit the property name as in this context the
/// property name does not add useful information.
///
/// `ifNull`, `ifEmpty`, `unit`, and `tooltip` make property
/// descriptions clearer. The examples in the code sample below illustrate
/// good uses of all of these parameters.
///
/// ## DiagnosticsProperty subclasses for primitive types
///
/// * [StringProperty], which supports automatically enclosing a [String]
/// value in quotes.
/// * [DoubleProperty], which supports specifying a unit of measurement for
/// a [double] value.
/// * [PercentProperty], which clamps a [double] to between 0 and 1 and
/// formats it as a percentage.
/// * [IntProperty], which supports specifying a unit of measurement for an
/// [int] value.
/// * [FlagProperty], which formats a [bool] value as one or more flags.
/// Depending on the use case it is better to format a bool as
/// `DiagnosticsProperty<bool>` instead of using [FlagProperty] as the
/// output is more verbose but unambiguous.
///
/// ## Other important [DiagnosticsProperty] variants
///
/// * [EnumProperty], which provides terse descriptions of enum values
/// working around limitations of the `toString` implementation for Dart
/// enum types.
/// * [IterableProperty], which handles iterable values with display
/// customizable depending on the [DiagnosticsTreeStyle] used.
/// * [ObjectFlagProperty], which provides terse descriptions of whether a
/// property value is present or not. For example, whether an `onClick`
/// callback is specified or an animation is in progress.
/// * [ColorProperty], which must be used if the property value is
/// a [Color] or one of its subclasses.
/// * [IconDataProperty], which must be used if the property value
/// is of type [IconData].
///
/// If none of these subclasses apply, use the [DiagnosticsProperty]
/// constructor or in rare cases create your own [DiagnosticsProperty]
/// subclass as in the case for [TransformProperty] which handles [Matrix4]
/// that represent transforms. Generally any property value with a good
/// `toString` method implementation works fine using [DiagnosticsProperty]
/// directly.
///
/// {@tool snippet}
///
/// This example shows best practices for implementing [debugFillProperties]
/// illustrating use of all common [DiagnosticsProperty] subclasses and all
/// common [DiagnosticsProperty] parameters.
///
/// ```dart
/// class ExampleObject extends ExampleSuperclass {
///
/// // ...various members and properties...
///
/// @override
/// void debugFillProperties(DiagnosticPropertiesBuilder properties) {
/// // Always add properties from the base class first.
/// super.debugFillProperties(properties);
///
/// // Omit the property name 'message' when displaying this String property
/// // as it would just add visual noise.
/// properties.add(StringProperty('message', message, showName: false));
///
/// properties.add(DoubleProperty('stepWidth', stepWidth));
///
/// // A scale of 1.0 does nothing so should be hidden.
/// properties.add(DoubleProperty('scale', scale, defaultValue: 1.0));
///
/// // If the hitTestExtent matches the paintExtent, it is just set to its
/// // default value so is not relevant.
/// properties.add(DoubleProperty('hitTestExtent', hitTestExtent, defaultValue: paintExtent));
///
/// // maxWidth of double.infinity indicates the width is unconstrained and
/// // so maxWidth has no impact.
/// properties.add(DoubleProperty('maxWidth', maxWidth, defaultValue: double.infinity));
///
/// // Progress is a value between 0 and 1 or null. Showing it as a
/// // percentage makes the meaning clear enough that the name can be
/// // hidden.
/// properties.add(PercentProperty(
/// 'progress',
/// progress,
/// showName: false,
/// ifNull: '<indeterminate>',
/// ));
///
/// // Most text fields have maxLines set to 1.
/// properties.add(IntProperty('maxLines', maxLines, defaultValue: 1));
///
/// // Specify the unit as otherwise it would be unclear that time is in
/// // milliseconds.
/// properties.add(IntProperty('duration', duration.inMilliseconds, unit: 'ms'));
///
/// // Tooltip is used instead of unit for this case as a unit should be a
/// // terse description appropriate to display directly after a number
/// // without a space.
/// properties.add(DoubleProperty(
/// 'device pixel ratio',
/// devicePixelRatio,
/// tooltip: 'physical pixels per logical pixel',
/// ));
///
/// // Displaying the depth value would be distracting. Instead only display
/// // if the depth value is missing.
/// properties.add(ObjectFlagProperty<int>('depth', depth, ifNull: 'no depth'));
///
/// // bool flag that is only shown when the value is true.
/// properties.add(FlagProperty('using primary controller', value: primary));
///
/// properties.add(FlagProperty(
/// 'isCurrent',
/// value: isCurrent,
/// ifTrue: 'active',
/// ifFalse: 'inactive',
/// ));
///
/// properties.add(DiagnosticsProperty<bool>('keepAlive', keepAlive));
///
/// // FlagProperty could have also been used in this case.
/// // This option results in the text "obscureText: true" instead
/// // of "obscureText" which is a bit more verbose but a bit clearer.
/// properties.add(DiagnosticsProperty<bool>('obscureText', obscureText, defaultValue: false));
///
/// properties.add(EnumProperty<TextAlign>('textAlign', textAlign, defaultValue: null));
/// properties.add(EnumProperty<ImageRepeat>('repeat', repeat, defaultValue: ImageRepeat.noRepeat));
///
/// // Warn users when the widget is missing but do not show the value.
/// properties.add(ObjectFlagProperty<Widget>('widget', widget, ifNull: 'no widget'));
///
/// properties.add(IterableProperty<BoxShadow>(
/// 'boxShadow',
/// boxShadow,
/// defaultValue: null,
/// style: style,
/// ));
///
/// // Getting the value of size throws an exception unless hasSize is true.
/// properties.add(DiagnosticsProperty<Size>.lazy(
/// 'size',
/// () => size,
/// description: '${ hasSize ? size : "MISSING" }',
/// ));
///
/// // If the `toString` method for the property value does not provide a
/// // good terse description, write a DiagnosticsProperty subclass as in
/// // the case of TransformProperty which displays a nice debugging view
/// // of a Matrix4 that represents a transform.
/// properties.add(TransformProperty('transform', transform));
///
/// // If the value class has a good `toString` method, use
/// // DiagnosticsProperty<YourValueType>. Specifying the value type ensures
/// // that debugging tools always know the type of the field and so can
/// // provide the right UI affordances. For example, in this case even
/// // if color is null, a debugging tool still knows the value is a Color
/// // and can display relevant color related UI.
/// properties.add(DiagnosticsProperty<Color>('color', color));
///
/// // Use a custom description to generate a more terse summary than the
/// // `toString` method on the map class.
/// properties.add(DiagnosticsProperty<Map<Listenable, VoidCallback>>(
/// 'handles',
/// handles,
/// description: handles != null
/// ? '${handles!.length} active client${ handles!.length == 1 ? "" : "s" }'
/// : null,
/// ifNull: 'no notifications ever received',
/// showName: false,
/// ));
/// }
/// }
/// ```
/// {@end-tool}
///
/// Used by [toDiagnosticsNode] and [toString].
///
/// Do not add values that have lifetime shorter than the object.
@protected
@mustCallSuper
void debugFillProperties(DiagnosticPropertiesBuilder properties) { }
}
/// A base class for providing string and [DiagnosticsNode] debug
/// representations describing the properties and children of an object.
///
/// The string debug representation is generated from the intermediate
/// [DiagnosticsNode] representation. The [DiagnosticsNode] representation is
/// also used by debugging tools displaying interactive trees of objects and
/// properties.
///
/// See also:
///
/// * [DiagnosticableTreeMixin], a mixin that implements this class.
/// * [Diagnosticable], which should be used instead of this class to
/// provide diagnostics for objects without children.
abstract class DiagnosticableTree with Diagnosticable {
/// Abstract const constructor. This constructor enables subclasses to provide
/// const constructors so that they can be used in const expressions.
const DiagnosticableTree();
/// Returns a one-line detailed description of the object.
///
/// This description is often somewhat long. This includes the same
/// information given by [toStringDeep], but does not recurse to any children.
///
/// `joiner` specifies the string which is place between each part obtained
/// from [debugFillProperties]. Passing a string such as `'\n '` will result
/// in a multiline string that indents the properties of the object below its
/// name (as per [toString]).
///
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// See also:
///
/// * [toString], for a brief description of the object.
/// * [toStringDeep], for a description of the subtree rooted at this object.
String toStringShallow({
String joiner = ', ',
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
String? shallowString;
assert(() {
final StringBuffer result = StringBuffer();
result.write(toString());
result.write(joiner);
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
debugFillProperties(builder);
result.write(
builder.properties.where((DiagnosticsNode n) => !n.isFiltered(minLevel))
.join(joiner),
);
shallowString = result.toString();
return true;
}());
return shallowString ?? toString();
}
/// Returns a string representation of this node and its descendants.
///
/// `prefixLineOne` will be added to the front of the first line of the
/// output. `prefixOtherLines` will be added to the front of each other line.
/// If `prefixOtherLines` is null, the `prefixLineOne` is used for every line.
/// By default, there is no prefix.
///
/// `minLevel` specifies the minimum [DiagnosticLevel] for properties included
/// in the output.
///
/// The [toStringDeep] method takes other arguments, but those are intended
/// for internal use when recursing to the descendants, and so can be ignored.
///
/// See also:
///
/// * [toString], for a brief description of the object but not its children.
/// * [toStringShallow], for a detailed description of the object but not its
/// children.
String toStringDeep({
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
}
@override
String toStringShort() => describeIdentity(this);
@override
DiagnosticsNode toDiagnosticsNode({ String? name, DiagnosticsTreeStyle? style }) {
return DiagnosticableTreeNode(
name: name,
value: this,
style: style,
);
}
/// Returns a list of [DiagnosticsNode] objects describing this node's
/// children.
///
/// Children that are offstage should be added with `style` set to
/// [DiagnosticsTreeStyle.offstage] to indicate that they are offstage.
///
/// The list must not contain any null entries. If there are explicit null
/// children to report, consider [DiagnosticsNode.message] or
/// [DiagnosticsProperty<Object>] as possible [DiagnosticsNode] objects to
/// provide.
///
/// Used by [toStringDeep], [toDiagnosticsNode] and [toStringShallow].
///
/// See also:
///
/// * [RenderTable.debugDescribeChildren], which provides high quality custom
/// descriptions for its child nodes.
@protected
List<DiagnosticsNode> debugDescribeChildren() => const <DiagnosticsNode>[];
}
/// A mixin that helps dump string and [DiagnosticsNode] representations of trees.
///
/// This mixin is identical to class [DiagnosticableTree].
mixin DiagnosticableTreeMixin implements DiagnosticableTree {
@override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel);
}
@override
String toStringShallow({
String joiner = ', ',
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
String? shallowString;
assert(() {
final StringBuffer result = StringBuffer();
result.write(toStringShort());
result.write(joiner);
final DiagnosticPropertiesBuilder builder = DiagnosticPropertiesBuilder();
debugFillProperties(builder);
result.write(
builder.properties.where((DiagnosticsNode n) => !n.isFiltered(minLevel))
.join(joiner),
);
shallowString = result.toString();
return true;
}());
return shallowString ?? toString();
}
@override
String toStringDeep({
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
return toDiagnosticsNode().toStringDeep(prefixLineOne: prefixLineOne, prefixOtherLines: prefixOtherLines, minLevel: minLevel);
}
@override
String toStringShort() => describeIdentity(this);
@override
DiagnosticsNode toDiagnosticsNode({ String? name, DiagnosticsTreeStyle? style }) {
return DiagnosticableTreeNode(
name: name,
value: this,
style: style,
);
}
@override
List<DiagnosticsNode> debugDescribeChildren() => const <DiagnosticsNode>[];
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) { }
}
/// [DiagnosticsNode] that exists mainly to provide a container for other
/// diagnostics that typically lacks a meaningful value of its own.
///
/// This class is typically used for displaying complex nested error messages.
class DiagnosticsBlock extends DiagnosticsNode {
/// Creates a diagnostic with properties specified by [properties] and
/// children specified by [children].
DiagnosticsBlock({
super.name,
DiagnosticsTreeStyle super.style = DiagnosticsTreeStyle.whitespace,
bool showName = true,
super.showSeparator,
super.linePrefix,
this.value,
String? description,
this.level = DiagnosticLevel.info,
this.allowTruncate = false,
List<DiagnosticsNode> children = const<DiagnosticsNode>[],
List<DiagnosticsNode> properties = const <DiagnosticsNode>[],
}) : _description = description ?? '',
_children = children,
_properties = properties,
super(
showName: showName && name != null,
);
final List<DiagnosticsNode> _children;
final List<DiagnosticsNode> _properties;
@override
final DiagnosticLevel level;
final String _description;
@override
final Object? value;
@override
final bool allowTruncate;
@override
List<DiagnosticsNode> getChildren() => _children;
@override
List<DiagnosticsNode> getProperties() => _properties;
@override
String toDescription({TextTreeConfiguration? parentConfiguration}) => _description;
}
/// A delegate that configures how a hierarchy of [DiagnosticsNode]s should be
/// serialized.
///
/// Implement this class in a subclass to fully configure how [DiagnosticsNode]s
/// get serialized.
abstract class DiagnosticsSerializationDelegate {
/// Creates a simple [DiagnosticsSerializationDelegate] that controls the
/// [subtreeDepth] and whether to [includeProperties].
///
/// For additional configuration options, extend
/// [DiagnosticsSerializationDelegate] and provide custom implementations
/// for the methods of this class.
const factory DiagnosticsSerializationDelegate({
int subtreeDepth,
bool includeProperties,
}) = _DefaultDiagnosticsSerializationDelegate;
/// Returns a serializable map of additional information that will be included
/// in the serialization of the given [DiagnosticsNode].
///
/// This method is called for every [DiagnosticsNode] that's included in
/// the serialization.
Map<String, Object?> additionalNodeProperties(DiagnosticsNode node);
/// Filters the list of [DiagnosticsNode]s that will be included as children
/// for the given `owner` node.
///
/// The callback may return a subset of the children in the provided list
/// or replace the entire list with new child nodes.
///
/// See also:
///
/// * [subtreeDepth], which controls how many levels of children will be
/// included in the serialization.
List<DiagnosticsNode> filterChildren(List<DiagnosticsNode> nodes, DiagnosticsNode owner);
/// Filters the list of [DiagnosticsNode]s that will be included as properties
/// for the given `owner` node.
///
/// The callback may return a subset of the properties in the provided list
/// or replace the entire list with new property nodes.
///
/// By default, `nodes` is returned as-is.
///
/// See also:
///
/// * [includeProperties], which controls whether properties will be included
/// at all.
List<DiagnosticsNode> filterProperties(List<DiagnosticsNode> nodes, DiagnosticsNode owner);
/// Truncates the given list of [DiagnosticsNode] that will be added to the
/// serialization as children or properties of the `owner` node.
///
/// The method must return a subset of the provided nodes and may
/// not replace any nodes. While [filterProperties] and [filterChildren]
/// completely hide a node from the serialization, truncating a node will
/// leave a hint in the serialization that there were additional nodes in the
/// result that are not included in the current serialization.
///
/// By default, `nodes` is returned as-is.
List<DiagnosticsNode> truncateNodesList(List<DiagnosticsNode> nodes, DiagnosticsNode? owner);
/// Returns the [DiagnosticsSerializationDelegate] to be used
/// for adding the provided [DiagnosticsNode] to the serialization.
///
/// By default, this will return a copy of this delegate, which has the
/// [subtreeDepth] reduced by one.
///
/// This is called for nodes that will be added to the serialization as
/// property or child of another node. It may return the same delegate if no
/// changes to it are necessary.
DiagnosticsSerializationDelegate delegateForNode(DiagnosticsNode node);
/// Controls how many levels of children will be included in the serialized
/// hierarchy of [DiagnosticsNode]s.
///
/// Defaults to zero.
///
/// See also:
///
/// * [filterChildren], which provides a way to filter the children that
/// will be included.
int get subtreeDepth;
/// Whether to include the properties of a [DiagnosticsNode] in the
/// serialization.
///
/// Defaults to false.
///
/// See also:
///
/// * [filterProperties], which provides a way to filter the properties that
/// will be included.
bool get includeProperties;
/// Whether properties that have a [Diagnosticable] as value should be
/// expanded.
bool get expandPropertyValues;
/// Creates a copy of this [DiagnosticsSerializationDelegate] with the
/// provided values.
DiagnosticsSerializationDelegate copyWith({
int subtreeDepth,
bool includeProperties,
});
}
class _DefaultDiagnosticsSerializationDelegate implements DiagnosticsSerializationDelegate {
const _DefaultDiagnosticsSerializationDelegate({
this.includeProperties = false,
this.subtreeDepth = 0,
});
@override
Map<String, Object?> additionalNodeProperties(DiagnosticsNode node) {
return const <String, Object?>{};
}
@override
DiagnosticsSerializationDelegate delegateForNode(DiagnosticsNode node) {
return subtreeDepth > 0 ? copyWith(subtreeDepth: subtreeDepth - 1) : this;
}
@override
bool get expandPropertyValues => false;
@override
List<DiagnosticsNode> filterChildren(List<DiagnosticsNode> nodes, DiagnosticsNode owner) {
return nodes;
}
@override
List<DiagnosticsNode> filterProperties(List<DiagnosticsNode> nodes, DiagnosticsNode owner) {
return nodes;
}
@override
final bool includeProperties;
@override
final int subtreeDepth;
@override
List<DiagnosticsNode> truncateNodesList(List<DiagnosticsNode> nodes, DiagnosticsNode? owner) {
return nodes;
}
@override
DiagnosticsSerializationDelegate copyWith({int? subtreeDepth, bool? includeProperties}) {
return _DefaultDiagnosticsSerializationDelegate(
subtreeDepth: subtreeDepth ?? this.subtreeDepth,
includeProperties: includeProperties ?? this.includeProperties,
);
}
}
| flutter/packages/flutter/lib/src/foundation/diagnostics.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/foundation/diagnostics.dart",
"repo_id": "flutter",
"token_count": 41270
} | 792 |
// 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.
/// Constants for useful Unicode characters.
///
/// Currently, these characters are all related to bidirectional text.
///
/// See also:
///
/// * <http://unicode.org/reports/tr9/>, which describes the Unicode
/// bidirectional text algorithm.
abstract final class Unicode {
/// `U+202A LEFT-TO-RIGHT EMBEDDING`
///
/// Treat the following text as embedded left-to-right.
///
/// Use [PDF] to end the embedding.
static const String LRE = '\u202A';
/// `U+202B RIGHT-TO-LEFT EMBEDDING`
///
/// Treat the following text as embedded right-to-left.
///
/// Use [PDF] to end the embedding.
static const String RLE = '\u202B';
/// `U+202C POP DIRECTIONAL FORMATTING`
///
/// End the scope of the last [LRE], [RLE], [RLO], or [LRO].
static const String PDF = '\u202C';
/// `U+202A LEFT-TO-RIGHT OVERRIDE`
///
/// Force following characters to be treated as strong left-to-right characters.
///
/// For example, this causes Hebrew text to render backwards.
///
/// Use [PDF] to end the override.
static const String LRO = '\u202D';
/// `U+202B RIGHT-TO-LEFT OVERRIDE`
///
/// Force following characters to be treated as strong right-to-left characters.
///
/// For example, this causes English text to render backwards.
///
/// Use [PDF] to end the override.
static const String RLO = '\u202E';
/// `U+2066 LEFT-TO-RIGHT ISOLATE`
///
/// Treat the following text as isolated and left-to-right.
///
/// Use [PDI] to end the isolated scope.
static const String LRI = '\u2066';
/// `U+2067 RIGHT-TO-LEFT ISOLATE`
///
/// Treat the following text as isolated and right-to-left.
///
/// Use [PDI] to end the isolated scope.
static const String RLI = '\u2067';
/// `U+2068 FIRST STRONG ISOLATE`
///
/// Treat the following text as isolated and in the direction of its first
/// strong directional character that is not inside a nested isolate.
///
/// This essentially "auto-detects" the directionality of the text. It is not
/// 100% reliable. For example, Arabic text that starts with an English quote
/// will be detected as LTR, not RTL, which will lead to the text being in a
/// weird order.
///
/// Use [PDI] to end the isolated scope.
static const String FSI = '\u2068';
/// `U+2069 POP DIRECTIONAL ISOLATE`
///
/// End the scope of the last [LRI], [RLI], or [FSI].
static const String PDI = '\u2069';
/// `U+200E LEFT-TO-RIGHT MARK`
///
/// Left-to-right zero-width character.
static const String LRM = '\u200E';
/// `U+200F RIGHT-TO-LEFT MARK`
///
/// Right-to-left zero-width non-Arabic character.
static const String RLM = '\u200F';
/// `U+061C ARABIC LETTER MARK`
///
/// Right-to-left zero-width Arabic character.
static const String ALM = '\u061C';
}
| flutter/packages/flutter/lib/src/foundation/unicode.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/foundation/unicode.dart",
"repo_id": "flutter",
"token_count": 974
} | 793 |
// 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 'dart:async';
import 'package:flutter/foundation.dart';
import 'arena.dart';
import 'binding.dart';
import 'constants.dart';
import 'drag.dart';
import 'drag_details.dart';
import 'events.dart';
import 'recognizer.dart';
import 'velocity_tracker.dart';
export 'dart:ui' show Offset, PointerDeviceKind;
export 'arena.dart' show GestureDisposition;
export 'drag.dart' show Drag;
export 'events.dart' show PointerDownEvent;
export 'gesture_settings.dart' show DeviceGestureSettings;
/// Signature for when [MultiDragGestureRecognizer] recognizes the start of a drag gesture.
typedef GestureMultiDragStartCallback = Drag? Function(Offset position);
/// Per-pointer state for a [MultiDragGestureRecognizer].
///
/// A [MultiDragGestureRecognizer] tracks each pointer separately. The state for
/// each pointer is a subclass of [MultiDragPointerState].
abstract class MultiDragPointerState {
/// Creates per-pointer state for a [MultiDragGestureRecognizer].
MultiDragPointerState(this.initialPosition, this.kind, this.gestureSettings)
: _velocityTracker = VelocityTracker.withKind(kind) {
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if (kFlutterMemoryAllocationsEnabled) {
FlutterMemoryAllocations.instance.dispatchObjectCreated(
library: 'package:flutter/gestures.dart',
className: '$MultiDragPointerState',
object: this,
);
}
}
/// Device specific gesture configuration that should be preferred over
/// framework constants.
///
/// These settings are commonly retrieved from a [MediaQuery].
final DeviceGestureSettings? gestureSettings;
/// The global coordinates of the pointer when the pointer contacted the screen.
final Offset initialPosition;
final VelocityTracker _velocityTracker;
/// The kind of pointer performing the multi-drag gesture.
///
/// Used by subclasses to determine the appropriate hit slop, for example.
final PointerDeviceKind kind;
Drag? _client;
/// The offset of the pointer from the last position that was reported to the client.
///
/// After the pointer contacts the screen, the pointer might move some
/// distance before this movement will be recognized as a drag. This field
/// accumulates that movement so that we can report it to the client after
/// the drag starts.
Offset? get pendingDelta => _pendingDelta;
Offset? _pendingDelta = Offset.zero;
Duration? _lastPendingEventTimestamp;
GestureArenaEntry? _arenaEntry;
void _setArenaEntry(GestureArenaEntry entry) {
assert(_arenaEntry == null);
assert(pendingDelta != null);
assert(_client == null);
_arenaEntry = entry;
}
/// Resolve this pointer's entry in the [GestureArenaManager] with the given disposition.
@protected
@mustCallSuper
void resolve(GestureDisposition disposition) {
_arenaEntry!.resolve(disposition);
}
void _move(PointerMoveEvent event) {
assert(_arenaEntry != null);
if (!event.synthesized) {
_velocityTracker.addPosition(event.timeStamp, event.position);
}
if (_client != null) {
assert(pendingDelta == null);
// Call client last to avoid reentrancy.
_client!.update(DragUpdateDetails(
sourceTimeStamp: event.timeStamp,
delta: event.delta,
globalPosition: event.position,
));
} else {
assert(pendingDelta != null);
_pendingDelta = _pendingDelta! + event.delta;
_lastPendingEventTimestamp = event.timeStamp;
checkForResolutionAfterMove();
}
}
/// Override this to call resolve() if the drag should be accepted or rejected.
/// This is called when a pointer movement is received, but only if the gesture
/// has not yet been resolved.
@protected
void checkForResolutionAfterMove() { }
/// Called when the gesture was accepted.
///
/// Either immediately or at some future point before the gesture is disposed,
/// call starter(), passing it initialPosition, to start the drag.
@protected
void accepted(GestureMultiDragStartCallback starter);
/// Called when the gesture was rejected.
///
/// The [dispose] method will be called immediately following this.
@protected
@mustCallSuper
void rejected() {
assert(_arenaEntry != null);
assert(_client == null);
assert(pendingDelta != null);
_pendingDelta = null;
_lastPendingEventTimestamp = null;
_arenaEntry = null;
}
void _startDrag(Drag client) {
assert(_arenaEntry != null);
assert(_client == null);
assert(pendingDelta != null);
_client = client;
final DragUpdateDetails details = DragUpdateDetails(
sourceTimeStamp: _lastPendingEventTimestamp,
delta: pendingDelta!,
globalPosition: initialPosition,
);
_pendingDelta = null;
_lastPendingEventTimestamp = null;
// Call client last to avoid reentrancy.
_client!.update(details);
}
void _up() {
assert(_arenaEntry != null);
if (_client != null) {
assert(pendingDelta == null);
final DragEndDetails details = DragEndDetails(velocity: _velocityTracker.getVelocity());
final Drag client = _client!;
_client = null;
// Call client last to avoid reentrancy.
client.end(details);
} else {
assert(pendingDelta != null);
_pendingDelta = null;
_lastPendingEventTimestamp = null;
}
}
void _cancel() {
assert(_arenaEntry != null);
if (_client != null) {
assert(pendingDelta == null);
final Drag client = _client!;
_client = null;
// Call client last to avoid reentrancy.
client.cancel();
} else {
assert(pendingDelta != null);
_pendingDelta = null;
_lastPendingEventTimestamp = null;
}
}
/// Releases any resources used by the object.
@protected
@mustCallSuper
void dispose() {
// TODO(polina-c): stop duplicating code across disposables
// https://github.com/flutter/flutter/issues/137435
if (kFlutterMemoryAllocationsEnabled) {
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
}
_arenaEntry?.resolve(GestureDisposition.rejected);
_arenaEntry = null;
assert(() {
_pendingDelta = null;
return true;
}());
}
}
/// Recognizes movement on a per-pointer basis.
///
/// In contrast to [DragGestureRecognizer], [MultiDragGestureRecognizer] watches
/// each pointer separately, which means multiple drags can be recognized
/// concurrently if multiple pointers are in contact with the screen.
///
/// [MultiDragGestureRecognizer] is not intended to be used directly. Instead,
/// consider using one of its subclasses to recognize specific types for drag
/// gestures.
///
/// See also:
///
/// * [ImmediateMultiDragGestureRecognizer], the most straight-forward variant
/// of multi-pointer drag gesture recognizer.
/// * [HorizontalMultiDragGestureRecognizer], which only recognizes drags that
/// start horizontally.
/// * [VerticalMultiDragGestureRecognizer], which only recognizes drags that
/// start vertically.
/// * [DelayedMultiDragGestureRecognizer], which only recognizes drags that
/// start after a long-press gesture.
abstract class MultiDragGestureRecognizer extends GestureRecognizer {
/// Initialize the object.
///
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
MultiDragGestureRecognizer({
required super.debugOwner,
super.supportedDevices,
AllowedButtonsFilter? allowedButtonsFilter,
}) : super(allowedButtonsFilter: allowedButtonsFilter ?? _defaultButtonAcceptBehavior);
// Accept the input if, and only if, [kPrimaryButton] is pressed.
static bool _defaultButtonAcceptBehavior(int buttons) => buttons == kPrimaryButton;
/// Called when this class recognizes the start of a drag gesture.
///
/// The remaining notifications for this drag gesture are delivered to the
/// [Drag] object returned by this callback.
GestureMultiDragStartCallback? onStart;
Map<int, MultiDragPointerState>? _pointers = <int, MultiDragPointerState>{};
@override
void addAllowedPointer(PointerDownEvent event) {
assert(_pointers != null);
assert(!_pointers!.containsKey(event.pointer));
final MultiDragPointerState state = createNewPointerState(event);
_pointers![event.pointer] = state;
GestureBinding.instance.pointerRouter.addRoute(event.pointer, _handleEvent);
state._setArenaEntry(GestureBinding.instance.gestureArena.add(event.pointer, this));
}
/// Subclasses should override this method to create per-pointer state
/// objects to track the pointer associated with the given event.
@protected
@factory
MultiDragPointerState createNewPointerState(PointerDownEvent event);
void _handleEvent(PointerEvent event) {
assert(_pointers != null);
assert(_pointers!.containsKey(event.pointer));
final MultiDragPointerState state = _pointers![event.pointer]!;
if (event is PointerMoveEvent) {
state._move(event);
// We might be disposed here.
} else if (event is PointerUpEvent) {
assert(event.delta == Offset.zero);
state._up();
// We might be disposed here.
_removeState(event.pointer);
} else if (event is PointerCancelEvent) {
assert(event.delta == Offset.zero);
state._cancel();
// We might be disposed here.
_removeState(event.pointer);
} else if (event is! PointerDownEvent) {
// we get the PointerDownEvent that resulted in our addPointer getting called since we
// add ourselves to the pointer router then (before the pointer router has heard of
// the event).
assert(false);
}
}
@override
void acceptGesture(int pointer) {
assert(_pointers != null);
final MultiDragPointerState? state = _pointers![pointer];
if (state == null) {
return; // We might already have canceled this drag if the up comes before the accept.
}
state.accepted((Offset initialPosition) => _startDrag(initialPosition, pointer));
}
Drag? _startDrag(Offset initialPosition, int pointer) {
assert(_pointers != null);
final MultiDragPointerState state = _pointers![pointer]!;
assert(state._pendingDelta != null);
Drag? drag;
if (onStart != null) {
drag = invokeCallback<Drag?>('onStart', () => onStart!(initialPosition));
}
if (drag != null) {
state._startDrag(drag);
} else {
_removeState(pointer);
}
return drag;
}
@override
void rejectGesture(int pointer) {
assert(_pointers != null);
if (_pointers!.containsKey(pointer)) {
final MultiDragPointerState state = _pointers![pointer]!;
state.rejected();
_removeState(pointer);
} // else we already preemptively forgot about it (e.g. we got an up event)
}
void _removeState(int pointer) {
if (_pointers == null) {
// We've already been disposed. It's harmless to skip removing the state
// for the given pointer because dispose() has already removed it.
return;
}
assert(_pointers!.containsKey(pointer));
GestureBinding.instance.pointerRouter.removeRoute(pointer, _handleEvent);
_pointers!.remove(pointer)!.dispose();
}
@override
void dispose() {
_pointers!.keys.toList().forEach(_removeState);
assert(_pointers!.isEmpty);
_pointers = null;
super.dispose();
}
}
class _ImmediatePointerState extends MultiDragPointerState {
_ImmediatePointerState(super.initialPosition, super.kind, super.gestureSettings);
@override
void checkForResolutionAfterMove() {
assert(pendingDelta != null);
if (pendingDelta!.distance > computeHitSlop(kind, gestureSettings)) {
resolve(GestureDisposition.accepted);
}
}
@override
void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition);
}
}
/// Recognizes movement both horizontally and vertically on a per-pointer basis.
///
/// In contrast to [PanGestureRecognizer], [ImmediateMultiDragGestureRecognizer]
/// watches each pointer separately, which means multiple drags can be
/// recognized concurrently if multiple pointers are in contact with the screen.
///
/// See also:
///
/// * [PanGestureRecognizer], which recognizes only one drag gesture at a time,
/// regardless of how many fingers are involved.
/// * [HorizontalMultiDragGestureRecognizer], which only recognizes drags that
/// start horizontally.
/// * [VerticalMultiDragGestureRecognizer], which only recognizes drags that
/// start vertically.
/// * [DelayedMultiDragGestureRecognizer], which only recognizes drags that
/// start after a long-press gesture.
class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
/// Create a gesture recognizer for tracking multiple pointers at once.
///
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
ImmediateMultiDragGestureRecognizer({
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
});
@override
MultiDragPointerState createNewPointerState(PointerDownEvent event) {
return _ImmediatePointerState(event.position, event.kind, gestureSettings);
}
@override
String get debugDescription => 'multidrag';
}
class _HorizontalPointerState extends MultiDragPointerState {
_HorizontalPointerState(super.initialPosition, super.kind, super.gestureSettings);
@override
void checkForResolutionAfterMove() {
assert(pendingDelta != null);
if (pendingDelta!.dx.abs() > computeHitSlop(kind, gestureSettings)) {
resolve(GestureDisposition.accepted);
}
}
@override
void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition);
}
}
/// Recognizes movement in the horizontal direction on a per-pointer basis.
///
/// In contrast to [HorizontalDragGestureRecognizer],
/// [HorizontalMultiDragGestureRecognizer] watches each pointer separately,
/// which means multiple drags can be recognized concurrently if multiple
/// pointers are in contact with the screen.
///
/// See also:
///
/// * [HorizontalDragGestureRecognizer], a gesture recognizer that just
/// looks at horizontal movement.
/// * [ImmediateMultiDragGestureRecognizer], a similar recognizer, but without
/// the limitation that the drag must start horizontally.
/// * [VerticalMultiDragGestureRecognizer], which only recognizes drags that
/// start vertically.
class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
/// Create a gesture recognizer for tracking multiple pointers at once
/// but only if they first move horizontally.
///
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
HorizontalMultiDragGestureRecognizer({
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
});
@override
MultiDragPointerState createNewPointerState(PointerDownEvent event) {
return _HorizontalPointerState(event.position, event.kind, gestureSettings);
}
@override
String get debugDescription => 'horizontal multidrag';
}
class _VerticalPointerState extends MultiDragPointerState {
_VerticalPointerState(super.initialPosition, super.kind, super.gestureSettings);
@override
void checkForResolutionAfterMove() {
assert(pendingDelta != null);
if (pendingDelta!.dy.abs() > computeHitSlop(kind, gestureSettings)) {
resolve(GestureDisposition.accepted);
}
}
@override
void accepted(GestureMultiDragStartCallback starter) {
starter(initialPosition);
}
}
/// Recognizes movement in the vertical direction on a per-pointer basis.
///
/// In contrast to [VerticalDragGestureRecognizer],
/// [VerticalMultiDragGestureRecognizer] watches each pointer separately,
/// which means multiple drags can be recognized concurrently if multiple
/// pointers are in contact with the screen.
///
/// See also:
///
/// * [VerticalDragGestureRecognizer], a gesture recognizer that just
/// looks at vertical movement.
/// * [ImmediateMultiDragGestureRecognizer], a similar recognizer, but without
/// the limitation that the drag must start vertically.
/// * [HorizontalMultiDragGestureRecognizer], which only recognizes drags that
/// start horizontally.
class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
/// Create a gesture recognizer for tracking multiple pointers at once
/// but only if they first move vertically.
///
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
VerticalMultiDragGestureRecognizer({
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
});
@override
MultiDragPointerState createNewPointerState(PointerDownEvent event) {
return _VerticalPointerState(event.position, event.kind, gestureSettings);
}
@override
String get debugDescription => 'vertical multidrag';
}
class _DelayedPointerState extends MultiDragPointerState {
_DelayedPointerState(super.initialPosition, Duration delay, super.kind, super.gestureSettings) {
_timer = Timer(delay, _delayPassed);
}
Timer? _timer;
GestureMultiDragStartCallback? _starter;
void _delayPassed() {
assert(_timer != null);
assert(pendingDelta != null);
assert(pendingDelta!.distance <= computeHitSlop(kind, gestureSettings));
_timer = null;
if (_starter != null) {
_starter!(initialPosition);
_starter = null;
} else {
resolve(GestureDisposition.accepted);
}
assert(_starter == null);
}
void _ensureTimerStopped() {
_timer?.cancel();
_timer = null;
}
@override
void accepted(GestureMultiDragStartCallback starter) {
assert(_starter == null);
if (_timer == null) {
starter(initialPosition);
} else {
_starter = starter;
}
}
@override
void checkForResolutionAfterMove() {
if (_timer == null) {
// If we've been accepted by the gesture arena but the pointer moves too
// much before the timer fires, we end up a state where the timer is
// stopped but we keep getting calls to this function because we never
// actually started the drag. In this case, _starter will be non-null
// because we're essentially waiting forever to start the drag.
assert(_starter != null);
return;
}
assert(pendingDelta != null);
if (pendingDelta!.distance > computeHitSlop(kind, gestureSettings)) {
resolve(GestureDisposition.rejected);
_ensureTimerStopped();
}
}
@override
void dispose() {
_ensureTimerStopped();
super.dispose();
}
}
/// Recognizes movement both horizontally and vertically on a per-pointer basis
/// after a delay.
///
/// In contrast to [ImmediateMultiDragGestureRecognizer],
/// [DelayedMultiDragGestureRecognizer] waits for a [delay] before recognizing
/// the drag. If the pointer moves more than [kTouchSlop] before the delay
/// expires, the gesture is not recognized.
///
/// In contrast to [PanGestureRecognizer], [DelayedMultiDragGestureRecognizer]
/// watches each pointer separately, which means multiple drags can be
/// recognized concurrently if multiple pointers are in contact with the screen.
///
/// See also:
///
/// * [ImmediateMultiDragGestureRecognizer], a similar recognizer but without
/// the delay.
/// * [PanGestureRecognizer], which recognizes only one drag gesture at a time,
/// regardless of how many fingers are involved.
class DelayedMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
/// Creates a drag recognizer that works on a per-pointer basis after a delay.
///
/// In order for a drag to be recognized by this recognizer, the pointer must
/// remain in the same place for [delay] (up to [kTouchSlop]). The [delay]
/// defaults to [kLongPressTimeout] to match [LongPressGestureRecognizer] but
/// can be changed for specific behaviors.
///
/// {@macro flutter.gestures.GestureRecognizer.supportedDevices}
DelayedMultiDragGestureRecognizer({
this.delay = kLongPressTimeout,
super.debugOwner,
super.supportedDevices,
super.allowedButtonsFilter,
});
/// The amount of time the pointer must remain in the same place for the drag
/// to be recognized.
final Duration delay;
@override
MultiDragPointerState createNewPointerState(PointerDownEvent event) {
return _DelayedPointerState(event.position, delay, event.kind, gestureSettings);
}
@override
String get debugDescription => 'long multidrag';
}
| flutter/packages/flutter/lib/src/gestures/multidrag.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/gestures/multidrag.dart",
"repo_id": "flutter",
"token_count": 6499
} | 794 |
// 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 widgets implementing Material Design animated icons.
library material_animated_icons;
import 'dart:math' as math show pi;
import 'dart:ui' as ui show Canvas, Paint, Path, lerpDouble;
import 'package:flutter/foundation.dart' show clampDouble;
import 'package:flutter/widgets.dart';
// This package is split into multiple parts to enable a private API that is
// testable.
// Public API.
part 'animated_icons/animated_icons.dart';
// Provides a public interface for referring to the private icon
// implementations.
part 'animated_icons/animated_icons_data.dart';
// Generated animated icon data files.
part 'animated_icons/data/add_event.g.dart';
part 'animated_icons/data/arrow_menu.g.dart';
part 'animated_icons/data/close_menu.g.dart';
part 'animated_icons/data/ellipsis_search.g.dart';
part 'animated_icons/data/event_add.g.dart';
part 'animated_icons/data/home_menu.g.dart';
part 'animated_icons/data/list_view.g.dart';
part 'animated_icons/data/menu_arrow.g.dart';
part 'animated_icons/data/menu_close.g.dart';
part 'animated_icons/data/menu_home.g.dart';
part 'animated_icons/data/pause_play.g.dart';
part 'animated_icons/data/play_pause.g.dart';
part 'animated_icons/data/search_ellipsis.g.dart';
part 'animated_icons/data/view_list.g.dart';
| flutter/packages/flutter/lib/src/material/animated_icons.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/material/animated_icons.dart",
"repo_id": "flutter",
"token_count": 491
} | 795 |
// 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.
// AUTOGENERATED FILE DO NOT EDIT!
// This file was generated by vitool.
part of material_animated_icons; // ignore: use_string_in_part_of_directives
const _AnimatedIconData _$view_list = _AnimatedIconData(
Size(48.0, 48.0),
<_PathFrames>[
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(44.69110902782625, 12.484010802427473),
Offset(44.91169585808795, 12.889600531986844),
Offset(45.905579651564764, 15.006358905929599),
Offset(46.93099203454209, 18.091564986244922),
Offset(47.57487910345822, 21.7717551172888),
Offset(47.611090562906426, 25.804550478715143),
Offset(46.90934109732998, 29.991835318680575),
Offset(45.41657507137544, 34.10298531188382),
Offset(43.12531983681261, 37.96288441331596),
Offset(40.11875918372392, 41.34720733654602),
Offset(36.52311532698831, 44.097551654541164),
Offset(32.469796235554185, 46.11340208398952),
Offset(28.106936276731332, 47.32108647595278),
Offset(23.593982433468472, 47.67646826990182),
Offset(19.205125831976975, 47.18941960707135),
Offset(15.060647386344348, 45.9277900128747),
Offset(11.36456649310902, 44.027127105327324),
Offset(8.242362271905536, 41.67588337906012),
Offset(5.7867901900563705, 39.13337333243891),
Offset(4.073681185543615, 36.793819543226384),
Offset(3.3006450057068637, 35.50116093358544),
Offset(3.3000000000000016, 35.5),
],
),
_PathCubicTo(
<Offset>[
Offset(44.69110902782625, 12.484010802427473),
Offset(44.91169585808795, 12.889600531986844),
Offset(45.905579651564764, 15.006358905929599),
Offset(46.93099203454209, 18.091564986244922),
Offset(47.57487910345822, 21.7717551172888),
Offset(47.611090562906426, 25.804550478715143),
Offset(46.90934109732998, 29.991835318680575),
Offset(45.41657507137544, 34.10298531188382),
Offset(43.12531983681261, 37.96288441331596),
Offset(40.11875918372392, 41.34720733654602),
Offset(36.52311532698831, 44.097551654541164),
Offset(32.469796235554185, 46.11340208398952),
Offset(28.106936276731332, 47.32108647595278),
Offset(23.593982433468472, 47.67646826990182),
Offset(19.205125831976975, 47.18941960707135),
Offset(15.060647386344348, 45.9277900128747),
Offset(11.36456649310902, 44.027127105327324),
Offset(8.242362271905536, 41.67588337906012),
Offset(5.7867901900563705, 39.13337333243891),
Offset(4.073681185543615, 36.793819543226384),
Offset(3.3006450057068637, 35.50116093358544),
Offset(3.3000000000000016, 35.5),
],
<Offset>[
Offset(40.091110400688535, 12.487564720144858),
Offset(40.3125022719963, 12.803470643716631),
Offset(41.33730753204713, 14.467016860435445),
Offset(42.479650461341066, 16.931583004189925),
Offset(43.36138596487936, 19.926091125347472),
Offset(43.771900701159595, 23.27065600469687),
Offset(43.58434311086645, 26.813095255382933),
Offset(42.73290999433846, 30.366952422000203),
Offset(41.194877262006315, 33.787553113242254),
Offset(39.018140391822314, 36.880817488479344),
Offset(36.292544012456446, 39.503333889903196),
Offset(33.117698958194936, 41.55925868901449),
Offset(29.60963450105552, 42.973455161476714),
Offset(25.896557894757017, 43.69423946619505),
Offset(22.20703084230837, 43.70394025568405),
Offset(18.647310095538202, 43.04753818178802),
Offset(15.399557758932708, 41.81831622960108),
Offset(12.585723714323475, 40.16088787394561),
Offset(10.307276132541034, 38.28178255994396),
Offset(8.664359809057567, 36.50112554668383),
Offset(7.900644998472249, 35.500902944325),
Offset(7.900000000000001, 35.5),
],
<Offset>[
Offset(40.091110400688535, 12.487564720144858),
Offset(40.3125022719963, 12.803470643716631),
Offset(41.33730753204713, 14.467016860435445),
Offset(42.479650461341066, 16.931583004189925),
Offset(43.36138596487936, 19.926091125347472),
Offset(43.771900701159595, 23.27065600469687),
Offset(43.58434311086645, 26.813095255382933),
Offset(42.73290999433846, 30.366952422000203),
Offset(41.194877262006315, 33.787553113242254),
Offset(39.018140391822314, 36.880817488479344),
Offset(36.292544012456446, 39.503333889903196),
Offset(33.117698958194936, 41.55925868901449),
Offset(29.60963450105552, 42.973455161476714),
Offset(25.896557894757017, 43.69423946619505),
Offset(22.20703084230837, 43.70394025568405),
Offset(18.647310095538202, 43.04753818178802),
Offset(15.399557758932708, 41.81831622960108),
Offset(12.585723714323475, 40.16088787394561),
Offset(10.307276132541034, 38.28178255994396),
Offset(8.664359809057567, 36.50112554668383),
Offset(7.900644998472249, 35.500902944325),
Offset(7.900000000000001, 35.5),
],
),
_PathCubicTo(
<Offset>[
Offset(40.091110400688535, 12.487564720144858),
Offset(40.3125022719963, 12.803470643716631),
Offset(41.33730753204713, 14.467016860435445),
Offset(42.479650461341066, 16.931583004189925),
Offset(43.36138596487936, 19.926091125347472),
Offset(43.771900701159595, 23.27065600469687),
Offset(43.58434311086645, 26.813095255382933),
Offset(42.73290999433846, 30.366952422000203),
Offset(41.194877262006315, 33.787553113242254),
Offset(39.018140391822314, 36.880817488479344),
Offset(36.292544012456446, 39.503333889903196),
Offset(33.117698958194936, 41.55925868901449),
Offset(29.60963450105552, 42.973455161476714),
Offset(25.896557894757017, 43.69423946619505),
Offset(22.20703084230837, 43.70394025568405),
Offset(18.647310095538202, 43.04753818178802),
Offset(15.399557758932708, 41.81831622960108),
Offset(12.585723714323475, 40.16088787394561),
Offset(10.307276132541034, 38.28178255994396),
Offset(8.664359809057567, 36.50112554668383),
Offset(7.900644998472249, 35.500902944325),
Offset(7.900000000000001, 35.5),
],
<Offset>[
Offset(40.094664318405925, 17.087563347282572),
Offset(40.22637238372609, 17.40266422980828),
Offset(40.79796548655297, 19.035288979953084),
Offset(41.31966847928607, 21.38292457739095),
Offset(41.51572197293803, 24.13958426392634),
Offset(41.23800622714133, 27.109845866443706),
Offset(40.40560304756881, 30.13809324184646),
Offset(38.996877104454846, 33.05061749903718),
Offset(37.01954596193261, 35.717995688048546),
Offset(34.55175054375564, 37.98143628038095),
Offset(31.69832624781848, 39.73390520443506),
Offset(28.563555563219907, 40.91135596637374),
Offset(25.26200318657945, 41.47075693715253),
Offset(21.914329091050245, 41.3916640049065),
Offset(18.72155149092107, 40.702035245352654),
Offset(15.767058264451522, 39.46087547259416),
Offset(13.190746883206462, 37.78332496377739),
Offset(11.070728209208971, 35.817526431527675),
Offset(9.455685360046092, 33.761296617459294),
Offset(8.37166581251501, 31.91044692316988),
Offset(7.90038700921181, 30.900902951559615),
Offset(7.900000000000001, 30.900000000000002),
],
<Offset>[
Offset(40.094664318405925, 17.087563347282572),
Offset(40.22637238372609, 17.40266422980828),
Offset(40.79796548655297, 19.035288979953084),
Offset(41.31966847928607, 21.38292457739095),
Offset(41.51572197293803, 24.13958426392634),
Offset(41.23800622714133, 27.109845866443706),
Offset(40.40560304756881, 30.13809324184646),
Offset(38.996877104454846, 33.05061749903718),
Offset(37.01954596193261, 35.717995688048546),
Offset(34.55175054375564, 37.98143628038095),
Offset(31.69832624781848, 39.73390520443506),
Offset(28.563555563219907, 40.91135596637374),
Offset(25.26200318657945, 41.47075693715253),
Offset(21.914329091050245, 41.3916640049065),
Offset(18.72155149092107, 40.702035245352654),
Offset(15.767058264451522, 39.46087547259416),
Offset(13.190746883206462, 37.78332496377739),
Offset(11.070728209208971, 35.817526431527675),
Offset(9.455685360046092, 33.761296617459294),
Offset(8.37166581251501, 31.91044692316988),
Offset(7.90038700921181, 30.900902951559615),
Offset(7.900000000000001, 30.900000000000002),
],
),
_PathCubicTo(
<Offset>[
Offset(40.094664318405925, 17.087563347282572),
Offset(40.22637238372609, 17.40266422980828),
Offset(40.79796548655297, 19.035288979953084),
Offset(41.31966847928607, 21.38292457739095),
Offset(41.51572197293803, 24.13958426392634),
Offset(41.23800622714133, 27.109845866443706),
Offset(40.40560304756881, 30.13809324184646),
Offset(38.996877104454846, 33.05061749903718),
Offset(37.01954596193261, 35.717995688048546),
Offset(34.55175054375564, 37.98143628038095),
Offset(31.69832624781848, 39.73390520443506),
Offset(28.563555563219907, 40.91135596637374),
Offset(25.26200318657945, 41.47075693715253),
Offset(21.914329091050245, 41.3916640049065),
Offset(18.72155149092107, 40.702035245352654),
Offset(15.767058264451522, 39.46087547259416),
Offset(13.190746883206462, 37.78332496377739),
Offset(11.070728209208971, 35.817526431527675),
Offset(9.455685360046092, 33.761296617459294),
Offset(8.37166581251501, 31.91044692316988),
Offset(7.90038700921181, 30.900902951559615),
Offset(7.900000000000001, 30.900000000000002),
],
<Offset>[
Offset(44.69466294554364, 17.084009429565185),
Offset(44.82556596981774, 17.488794118078495),
Offset(45.366237606070605, 19.57463102544724),
Offset(45.7710100524871, 22.542906559445946),
Offset(45.72921511151689, 25.98524825586767),
Offset(45.07719608888816, 29.643740340461978),
Offset(43.73060103403234, 33.3168333051441),
Offset(41.68054218149182, 36.7866503889208),
Offset(38.9499885367389, 39.893326988122254),
Offset(35.65236933565724, 42.44782612844762),
Offset(31.928897562350347, 44.32812296907303),
Offset(27.915652840579153, 45.46549936134877),
Offset(23.75930496225526, 45.8183882516286),
Offset(19.6117536297617, 45.37389280861327),
Offset(15.719646480589672, 44.18751459673995),
Offset(12.180395555257666, 42.34112730368084),
Offset(9.155755617382773, 39.99213583950363),
Offset(6.7273667667910315, 37.33252193664218),
Offset(4.935199417561428, 34.61288738995424),
Offset(3.7809871890010585, 32.20314091971243),
Offset(3.3003870164464253, 30.901160940820056),
Offset(3.3000000000000016, 30.900000000000002),
],
<Offset>[
Offset(44.69466294554364, 17.084009429565185),
Offset(44.82556596981774, 17.488794118078495),
Offset(45.366237606070605, 19.57463102544724),
Offset(45.7710100524871, 22.542906559445946),
Offset(45.72921511151689, 25.98524825586767),
Offset(45.07719608888816, 29.643740340461978),
Offset(43.73060103403234, 33.3168333051441),
Offset(41.68054218149182, 36.7866503889208),
Offset(38.9499885367389, 39.893326988122254),
Offset(35.65236933565724, 42.44782612844762),
Offset(31.928897562350347, 44.32812296907303),
Offset(27.915652840579153, 45.46549936134877),
Offset(23.75930496225526, 45.8183882516286),
Offset(19.6117536297617, 45.37389280861327),
Offset(15.719646480589672, 44.18751459673995),
Offset(12.180395555257666, 42.34112730368084),
Offset(9.155755617382773, 39.99213583950363),
Offset(6.7273667667910315, 37.33252193664218),
Offset(4.935199417561428, 34.61288738995424),
Offset(3.7809871890010585, 32.20314091971243),
Offset(3.3003870164464253, 30.901160940820056),
Offset(3.3000000000000016, 30.900000000000002),
],
),
_PathCubicTo(
<Offset>[
Offset(44.69466294554364, 17.084009429565185),
Offset(44.82556596981774, 17.488794118078495),
Offset(45.366237606070605, 19.57463102544724),
Offset(45.7710100524871, 22.542906559445946),
Offset(45.72921511151689, 25.98524825586767),
Offset(45.07719608888816, 29.643740340461978),
Offset(43.73060103403234, 33.3168333051441),
Offset(41.68054218149182, 36.7866503889208),
Offset(38.9499885367389, 39.893326988122254),
Offset(35.65236933565724, 42.44782612844762),
Offset(31.928897562350347, 44.32812296907303),
Offset(27.915652840579153, 45.46549936134877),
Offset(23.75930496225526, 45.8183882516286),
Offset(19.6117536297617, 45.37389280861327),
Offset(15.719646480589672, 44.18751459673995),
Offset(12.180395555257666, 42.34112730368084),
Offset(9.155755617382773, 39.99213583950363),
Offset(6.7273667667910315, 37.33252193664218),
Offset(4.935199417561428, 34.61288738995424),
Offset(3.7809871890010585, 32.20314091971243),
Offset(3.3003870164464253, 30.901160940820056),
Offset(3.3000000000000016, 30.900000000000002),
],
<Offset>[
Offset(44.69110902782625, 12.484010802427473),
Offset(44.91169585808795, 12.889600531986844),
Offset(45.905579651564764, 15.006358905929599),
Offset(46.93099203454209, 18.091564986244922),
Offset(47.57487910345822, 21.7717551172888),
Offset(47.611090562906426, 25.804550478715143),
Offset(46.90934109732998, 29.991835318680575),
Offset(45.41657507137544, 34.10298531188382),
Offset(43.12531983681261, 37.96288441331596),
Offset(40.11875918372392, 41.34720733654602),
Offset(36.52311532698831, 44.097551654541164),
Offset(32.469796235554185, 46.11340208398952),
Offset(28.106936276731332, 47.32108647595278),
Offset(23.593982433468472, 47.67646826990182),
Offset(19.205125831976975, 47.18941960707135),
Offset(15.060647386344348, 45.9277900128747),
Offset(11.36456649310902, 44.027127105327324),
Offset(8.242362271905536, 41.67588337906012),
Offset(5.7867901900563705, 39.13337333243891),
Offset(4.073681185543615, 36.793819543226384),
Offset(3.3006450057068637, 35.50116093358544),
Offset(3.3000000000000016, 35.5),
],
<Offset>[
Offset(44.69110902782625, 12.484010802427473),
Offset(44.91169585808795, 12.889600531986844),
Offset(45.905579651564764, 15.006358905929599),
Offset(46.93099203454209, 18.091564986244922),
Offset(47.57487910345822, 21.7717551172888),
Offset(47.611090562906426, 25.804550478715143),
Offset(46.90934109732998, 29.991835318680575),
Offset(45.41657507137544, 34.10298531188382),
Offset(43.12531983681261, 37.96288441331596),
Offset(40.11875918372392, 41.34720733654602),
Offset(36.52311532698831, 44.097551654541164),
Offset(32.469796235554185, 46.11340208398952),
Offset(28.106936276731332, 47.32108647595278),
Offset(23.593982433468472, 47.67646826990182),
Offset(19.205125831976975, 47.18941960707135),
Offset(15.060647386344348, 45.9277900128747),
Offset(11.36456649310902, 44.027127105327324),
Offset(8.242362271905536, 41.67588337906012),
Offset(5.7867901900563705, 39.13337333243891),
Offset(4.073681185543615, 36.793819543226384),
Offset(3.3006450057068637, 35.50116093358544),
Offset(3.3000000000000016, 35.5),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(44.7053246986958, 30.884005310978335),
Offset(44.567176305007095, 31.28637487635344),
Offset(43.74821146958815, 33.27944738400016),
Offset(42.29106410632212, 35.896931279049014),
Offset(40.19222313569291, 38.62572767160428),
Offset(37.47551266683334, 41.16130992570247),
Offset(34.19438084413941, 43.291827264534675),
Offset(30.472443511840986, 44.83764562003173),
Offset(26.423994636517765, 45.684654712541146),
Offset(22.25319979145722, 45.749682504152446),
Offset(18.146244268436455, 45.01983691266863),
Offset(14.253222655654064, 43.5217911934265),
Offset(10.71641101882705, 41.31029357865603),
Offset(7.665067218641396, 38.46616642474764),
Offset(5.263208426427763, 35.18179956574576),
Offset(3.5396400619976247, 31.581139176099278),
Offset(2.529322990204036, 27.887162042032575),
Offset(2.1823802514475172, 24.302437609388363),
Offset(2.3804271000766017, 21.051429562500246),
Offset(2.902905199373388, 18.43110504917058),
Offset(3.2996130486651083, 17.1011609625239),
Offset(3.3000000000000016, 17.1),
],
),
_PathCubicTo(
<Offset>[
Offset(44.7053246986958, 30.884005310978335),
Offset(44.567176305007095, 31.28637487635344),
Offset(43.74821146958815, 33.27944738400016),
Offset(42.29106410632212, 35.896931279049014),
Offset(40.19222313569291, 38.62572767160428),
Offset(37.47551266683334, 41.16130992570247),
Offset(34.19438084413941, 43.291827264534675),
Offset(30.472443511840986, 44.83764562003173),
Offset(26.423994636517765, 45.684654712541146),
Offset(22.25319979145722, 45.749682504152446),
Offset(18.146244268436455, 45.01983691266863),
Offset(14.253222655654064, 43.5217911934265),
Offset(10.71641101882705, 41.31029357865603),
Offset(7.665067218641396, 38.46616642474764),
Offset(5.263208426427763, 35.18179956574576),
Offset(3.5396400619976247, 31.581139176099278),
Offset(2.529322990204036, 27.887162042032575),
Offset(2.1823802514475172, 24.302437609388363),
Offset(2.3804271000766017, 21.051429562500246),
Offset(2.902905199373388, 18.43110504917058),
Offset(3.2996130486651083, 17.1011609625239),
Offset(3.3000000000000016, 17.1),
],
<Offset>[
Offset(40.10532607155808, 30.88755922869572),
Offset(39.967982718915444, 31.200244988083227),
Offset(39.17993935007051, 32.740105338506),
Offset(37.83972253312109, 34.73694929699402),
Offset(35.978729997114044, 36.78006367966295),
Offset(33.63632280508651, 38.6274154516842),
Offset(30.869382857675884, 40.113087201237036),
Offset(27.788778434804005, 41.10161273014811),
Offset(24.49355206171147, 41.50932341246744),
Offset(21.152580999555614, 41.28329265608577),
Offset(17.915672953904586, 40.42561914803066),
Offset(14.901125378294816, 38.96764779845147),
Offset(12.219109243151237, 36.96266226417996),
Offset(9.96764267992994, 34.48393762104087),
Offset(8.26511343675916, 31.69632021435846),
Offset(7.126302771191481, 28.7008873450126),
Offset(6.564314256027725, 25.678351166306328),
Offset(6.525741693865457, 22.787442104273858),
Offset(6.900913042561266, 20.199838790005305),
Offset(7.49358382288734, 18.138411052628022),
Offset(7.899613041430493, 17.10090297326346),
Offset(7.900000000000001, 17.1),
],
<Offset>[
Offset(40.10532607155808, 30.88755922869572),
Offset(39.967982718915444, 31.200244988083227),
Offset(39.17993935007051, 32.740105338506),
Offset(37.83972253312109, 34.73694929699402),
Offset(35.978729997114044, 36.78006367966295),
Offset(33.63632280508651, 38.6274154516842),
Offset(30.869382857675884, 40.113087201237036),
Offset(27.788778434804005, 41.10161273014811),
Offset(24.49355206171147, 41.50932341246744),
Offset(21.152580999555614, 41.28329265608577),
Offset(17.915672953904586, 40.42561914803066),
Offset(14.901125378294816, 38.96764779845147),
Offset(12.219109243151237, 36.96266226417996),
Offset(9.96764267992994, 34.48393762104087),
Offset(8.26511343675916, 31.69632021435846),
Offset(7.126302771191481, 28.7008873450126),
Offset(6.564314256027725, 25.678351166306328),
Offset(6.525741693865457, 22.787442104273858),
Offset(6.900913042561266, 20.199838790005305),
Offset(7.49358382288734, 18.138411052628022),
Offset(7.899613041430493, 17.10090297326346),
Offset(7.900000000000001, 17.1),
],
),
_PathCubicTo(
<Offset>[
Offset(40.10532607155808, 30.88755922869572),
Offset(39.967982718915444, 31.200244988083227),
Offset(39.17993935007051, 32.740105338506),
Offset(37.83972253312109, 34.73694929699402),
Offset(35.978729997114044, 36.78006367966295),
Offset(33.63632280508651, 38.6274154516842),
Offset(30.869382857675884, 40.113087201237036),
Offset(27.788778434804005, 41.10161273014811),
Offset(24.49355206171147, 41.50932341246744),
Offset(21.152580999555614, 41.28329265608577),
Offset(17.915672953904586, 40.42561914803066),
Offset(14.901125378294816, 38.96764779845147),
Offset(12.219109243151237, 36.96266226417996),
Offset(9.96764267992994, 34.48393762104087),
Offset(8.26511343675916, 31.69632021435846),
Offset(7.126302771191481, 28.7008873450126),
Offset(6.564314256027725, 25.678351166306328),
Offset(6.525741693865457, 22.787442104273858),
Offset(6.900913042561266, 20.199838790005305),
Offset(7.49358382288734, 18.138411052628022),
Offset(7.899613041430493, 17.10090297326346),
Offset(7.900000000000001, 17.1),
],
<Offset>[
Offset(40.10887998927547, 35.48755785583344),
Offset(39.88185283064523, 35.79943857417488),
Offset(38.64059730457635, 37.308377458023635),
Offset(36.6797405510661, 39.18829087019505),
Offset(34.13306600517272, 40.993556818241814),
Offset(31.102428331068236, 42.46660531343103),
Offset(27.690642794378242, 43.438085187700565),
Offset(24.05274554492039, 43.78527780718509),
Offset(20.318220761637757, 43.43976598727373),
Offset(16.68619115148894, 42.38391144798737),
Offset(13.321455189266624, 40.65619046256253),
Offset(10.346981983319786, 38.31974507581072),
Offset(7.871477928675166, 35.45996403985578),
Offset(5.985413876223171, 32.181362159752325),
Offset(4.779634085371857, 28.694415204027067),
Offset(4.2460509401048, 25.114224635818744),
Offset(4.355503380301478, 21.64335990048264),
Offset(5.010746188750952, 18.44408066185592),
Offset(6.049322270066323, 15.67935284752064),
Offset(7.200889826344783, 13.547732429114072),
Offset(7.899355052170055, 12.500902980498076),
Offset(7.900000000000001, 12.5),
],
<Offset>[
Offset(40.10887998927547, 35.48755785583344),
Offset(39.88185283064523, 35.79943857417488),
Offset(38.64059730457635, 37.308377458023635),
Offset(36.6797405510661, 39.18829087019505),
Offset(34.13306600517272, 40.993556818241814),
Offset(31.102428331068236, 42.46660531343103),
Offset(27.690642794378242, 43.438085187700565),
Offset(24.05274554492039, 43.78527780718509),
Offset(20.318220761637757, 43.43976598727373),
Offset(16.68619115148894, 42.38391144798737),
Offset(13.321455189266624, 40.65619046256253),
Offset(10.346981983319786, 38.31974507581072),
Offset(7.871477928675166, 35.45996403985578),
Offset(5.985413876223171, 32.181362159752325),
Offset(4.779634085371857, 28.694415204027067),
Offset(4.2460509401048, 25.114224635818744),
Offset(4.355503380301478, 21.64335990048264),
Offset(5.010746188750952, 18.44408066185592),
Offset(6.049322270066323, 15.67935284752064),
Offset(7.200889826344783, 13.547732429114072),
Offset(7.899355052170055, 12.500902980498076),
Offset(7.900000000000001, 12.5),
],
),
_PathCubicTo(
<Offset>[
Offset(40.10887998927547, 35.48755785583344),
Offset(39.88185283064523, 35.79943857417488),
Offset(38.64059730457635, 37.308377458023635),
Offset(36.6797405510661, 39.18829087019505),
Offset(34.13306600517272, 40.993556818241814),
Offset(31.102428331068236, 42.46660531343103),
Offset(27.690642794378242, 43.438085187700565),
Offset(24.05274554492039, 43.78527780718509),
Offset(20.318220761637757, 43.43976598727373),
Offset(16.68619115148894, 42.38391144798737),
Offset(13.321455189266624, 40.65619046256253),
Offset(10.346981983319786, 38.31974507581072),
Offset(7.871477928675166, 35.45996403985578),
Offset(5.985413876223171, 32.181362159752325),
Offset(4.779634085371857, 28.694415204027067),
Offset(4.2460509401048, 25.114224635818744),
Offset(4.355503380301478, 21.64335990048264),
Offset(5.010746188750952, 18.44408066185592),
Offset(6.049322270066323, 15.67935284752064),
Offset(7.200889826344783, 13.547732429114072),
Offset(7.899355052170055, 12.500902980498076),
Offset(7.900000000000001, 12.5),
],
<Offset>[
Offset(44.70887861641319, 35.48400393811605),
Offset(44.48104641673688, 35.88556846244509),
Offset(43.20886942409399, 37.847719503517794),
Offset(41.131082124267124, 40.34827285225004),
Offset(38.34655914375159, 42.83922081018314),
Offset(34.94161819281507, 45.0004997874493),
Offset(31.015640780841768, 46.616825250998204),
Offset(26.736410621957372, 47.52131069706871),
Offset(22.248663336444054, 47.61509728734744),
Offset(17.786809943390548, 46.85030129605405),
Offset(13.55202650379849, 45.250408227200495),
Offset(9.699079260679033, 42.87388847078575),
Offset(6.3687797043509775, 39.807595354331845),
Offset(3.682838414934627, 36.16359096345909),
Offset(1.77772907504046, 32.179894555414364),
Offset(0.6593882309109436, 27.99447646690542),
Offset(0.32051211447779027, 23.852170776208887),
Offset(0.6673847463330125, 19.959076166970426),
Offset(1.5288363275816592, 16.53094362001558),
Offset(2.6102112028308313, 13.840426425656629),
Offset(3.29935505940467, 12.501160969758514),
Offset(3.3000000000000016, 12.5),
],
<Offset>[
Offset(44.70887861641319, 35.48400393811605),
Offset(44.48104641673688, 35.88556846244509),
Offset(43.20886942409399, 37.847719503517794),
Offset(41.131082124267124, 40.34827285225004),
Offset(38.34655914375159, 42.83922081018314),
Offset(34.94161819281507, 45.0004997874493),
Offset(31.015640780841768, 46.616825250998204),
Offset(26.736410621957372, 47.52131069706871),
Offset(22.248663336444054, 47.61509728734744),
Offset(17.786809943390548, 46.85030129605405),
Offset(13.55202650379849, 45.250408227200495),
Offset(9.699079260679033, 42.87388847078575),
Offset(6.3687797043509775, 39.807595354331845),
Offset(3.682838414934627, 36.16359096345909),
Offset(1.77772907504046, 32.179894555414364),
Offset(0.6593882309109436, 27.99447646690542),
Offset(0.32051211447779027, 23.852170776208887),
Offset(0.6673847463330125, 19.959076166970426),
Offset(1.5288363275816592, 16.53094362001558),
Offset(2.6102112028308313, 13.840426425656629),
Offset(3.29935505940467, 12.501160969758514),
Offset(3.3000000000000016, 12.5),
],
),
_PathCubicTo(
<Offset>[
Offset(44.70887861641319, 35.48400393811605),
Offset(44.48104641673688, 35.88556846244509),
Offset(43.20886942409399, 37.847719503517794),
Offset(41.131082124267124, 40.34827285225004),
Offset(38.34655914375159, 42.83922081018314),
Offset(34.94161819281507, 45.0004997874493),
Offset(31.015640780841768, 46.616825250998204),
Offset(26.736410621957372, 47.52131069706871),
Offset(22.248663336444054, 47.61509728734744),
Offset(17.786809943390548, 46.85030129605405),
Offset(13.55202650379849, 45.250408227200495),
Offset(9.699079260679033, 42.87388847078575),
Offset(6.3687797043509775, 39.807595354331845),
Offset(3.682838414934627, 36.16359096345909),
Offset(1.77772907504046, 32.179894555414364),
Offset(0.6593882309109436, 27.99447646690542),
Offset(0.32051211447779027, 23.852170776208887),
Offset(0.6673847463330125, 19.959076166970426),
Offset(1.5288363275816592, 16.53094362001558),
Offset(2.6102112028308313, 13.840426425656629),
Offset(3.29935505940467, 12.501160969758514),
Offset(3.3000000000000016, 12.5),
],
<Offset>[
Offset(44.7053246986958, 30.884005310978335),
Offset(44.567176305007095, 31.28637487635344),
Offset(43.74821146958815, 33.27944738400016),
Offset(42.29106410632212, 35.896931279049014),
Offset(40.19222313569291, 38.62572767160428),
Offset(37.47551266683334, 41.16130992570247),
Offset(34.19438084413941, 43.291827264534675),
Offset(30.472443511840986, 44.83764562003173),
Offset(26.423994636517765, 45.684654712541146),
Offset(22.25319979145722, 45.749682504152446),
Offset(18.146244268436455, 45.01983691266863),
Offset(14.253222655654064, 43.5217911934265),
Offset(10.71641101882705, 41.31029357865603),
Offset(7.665067218641396, 38.46616642474764),
Offset(5.263208426427763, 35.18179956574576),
Offset(3.5396400619976247, 31.581139176099278),
Offset(2.529322990204036, 27.887162042032575),
Offset(2.1823802514475172, 24.302437609388363),
Offset(2.3804271000766017, 21.051429562500246),
Offset(2.902905199373388, 18.43110504917058),
Offset(3.2996130486651083, 17.1011609625239),
Offset(3.3000000000000016, 17.1),
],
<Offset>[
Offset(44.7053246986958, 30.884005310978335),
Offset(44.567176305007095, 31.28637487635344),
Offset(43.74821146958815, 33.27944738400016),
Offset(42.29106410632212, 35.896931279049014),
Offset(40.19222313569291, 38.62572767160428),
Offset(37.47551266683334, 41.16130992570247),
Offset(34.19438084413941, 43.291827264534675),
Offset(30.472443511840986, 44.83764562003173),
Offset(26.423994636517765, 45.684654712541146),
Offset(22.25319979145722, 45.749682504152446),
Offset(18.146244268436455, 45.01983691266863),
Offset(14.253222655654064, 43.5217911934265),
Offset(10.71641101882705, 41.31029357865603),
Offset(7.665067218641396, 38.46616642474764),
Offset(5.263208426427763, 35.18179956574576),
Offset(3.5396400619976247, 31.581139176099278),
Offset(2.529322990204036, 27.887162042032575),
Offset(2.1823802514475172, 24.302437609388363),
Offset(2.3804271000766017, 21.051429562500246),
Offset(2.902905199373388, 18.43110504917058),
Offset(3.2996130486651083, 17.1011609625239),
Offset(3.3000000000000016, 17.1),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(44.698216863261024, 21.684008056702904),
Offset(44.739436081547524, 22.08798770417014),
Offset(44.82689556057646, 24.14290314496488),
Offset(44.611028070432106, 26.99424813264697),
Offset(43.88355111957557, 30.19874139444654),
Offset(42.54330161486988, 33.482930202208806),
Offset(40.55186097073469, 36.64183129160762),
Offset(37.94450929160821, 39.470315465957775),
Offset(34.77465723666519, 41.823769562928554),
Offset(31.18597948759057, 43.548444920349226),
Offset(27.334679797712376, 44.5586942836049),
Offset(23.361509445604124, 44.81759663870801),
Offset(19.41167364777919, 44.315690027304406),
Offset(15.629524826054936, 43.07131734732473),
Offset(12.234167129202369, 41.18560958640855),
Offset(9.300143724170985, 38.754464594487),
Offset(6.946944741656527, 35.95714457367995),
Offset(5.2123712616765285, 32.989160494224244),
Offset(4.0836086450664855, 30.092401447469573),
Offset(3.4882931924585017, 27.61246229619848),
Offset(3.300129027185985, 26.30116094805467),
Offset(3.3000000000000016, 26.3),
],
),
_PathCubicTo(
<Offset>[
Offset(44.698216863261024, 21.684008056702904),
Offset(44.739436081547524, 22.08798770417014),
Offset(44.82689556057646, 24.14290314496488),
Offset(44.611028070432106, 26.99424813264697),
Offset(43.88355111957557, 30.19874139444654),
Offset(42.54330161486988, 33.482930202208806),
Offset(40.55186097073469, 36.64183129160762),
Offset(37.94450929160821, 39.470315465957775),
Offset(34.77465723666519, 41.823769562928554),
Offset(31.18597948759057, 43.548444920349226),
Offset(27.334679797712376, 44.5586942836049),
Offset(23.361509445604124, 44.81759663870801),
Offset(19.41167364777919, 44.315690027304406),
Offset(15.629524826054936, 43.07131734732473),
Offset(12.234167129202369, 41.18560958640855),
Offset(9.300143724170985, 38.754464594487),
Offset(6.946944741656527, 35.95714457367995),
Offset(5.2123712616765285, 32.989160494224244),
Offset(4.0836086450664855, 30.092401447469573),
Offset(3.4882931924585017, 27.61246229619848),
Offset(3.300129027185985, 26.30116094805467),
Offset(3.3000000000000016, 26.3),
],
<Offset>[
Offset(40.09821823612331, 21.68756197442029),
Offset(40.14024249545587, 22.001857815899925),
Offset(40.25862344105882, 23.603561099470724),
Offset(40.15968649723108, 25.834266150591972),
Offset(39.6700579809967, 28.35307740250521),
Offset(38.70411175312305, 30.949035728190534),
Offset(37.22686298427116, 33.463091228309985),
Offset(35.260844214571236, 35.73428257607416),
Offset(32.84421466185889, 37.64843826285484),
Offset(30.085360695688962, 39.08205507228256),
Offset(27.10410848318051, 39.96447651896693),
Offset(24.00941216824488, 40.26345324373298),
Offset(20.914371872103377, 39.96805871282834),
Offset(17.93210028734348, 39.08908854361796),
Offset(15.236072139533766, 37.700130235021255),
Offset(12.88680643336484, 35.874212763400315),
Offset(10.981936007480215, 33.748333697953704),
Offset(9.555732704094467, 31.474164989109738),
Offset(8.604094587551149, 29.240810674974632),
Offset(8.078971815972453, 27.319768299655923),
Offset(7.90012901995137, 26.300902958794232),
Offset(7.900000000000001, 26.3),
],
<Offset>[
Offset(40.09821823612331, 21.68756197442029),
Offset(40.14024249545587, 22.001857815899925),
Offset(40.25862344105882, 23.603561099470724),
Offset(40.15968649723108, 25.834266150591972),
Offset(39.6700579809967, 28.35307740250521),
Offset(38.70411175312305, 30.949035728190534),
Offset(37.22686298427116, 33.463091228309985),
Offset(35.260844214571236, 35.73428257607416),
Offset(32.84421466185889, 37.64843826285484),
Offset(30.085360695688962, 39.08205507228256),
Offset(27.10410848318051, 39.96447651896693),
Offset(24.00941216824488, 40.26345324373298),
Offset(20.914371872103377, 39.96805871282834),
Offset(17.93210028734348, 39.08908854361796),
Offset(15.236072139533766, 37.700130235021255),
Offset(12.88680643336484, 35.874212763400315),
Offset(10.981936007480215, 33.748333697953704),
Offset(9.555732704094467, 31.474164989109738),
Offset(8.604094587551149, 29.240810674974632),
Offset(8.078971815972453, 27.319768299655923),
Offset(7.90012901995137, 26.300902958794232),
Offset(7.900000000000001, 26.3),
],
),
_PathCubicTo(
<Offset>[
Offset(40.09821823612331, 21.68756197442029),
Offset(40.14024249545587, 22.001857815899925),
Offset(40.25862344105882, 23.603561099470724),
Offset(40.15968649723108, 25.834266150591972),
Offset(39.6700579809967, 28.35307740250521),
Offset(38.70411175312305, 30.949035728190534),
Offset(37.22686298427116, 33.463091228309985),
Offset(35.260844214571236, 35.73428257607416),
Offset(32.84421466185889, 37.64843826285484),
Offset(30.085360695688962, 39.08205507228256),
Offset(27.10410848318051, 39.96447651896693),
Offset(24.00941216824488, 40.26345324373298),
Offset(20.914371872103377, 39.96805871282834),
Offset(17.93210028734348, 39.08908854361796),
Offset(15.236072139533766, 37.700130235021255),
Offset(12.88680643336484, 35.874212763400315),
Offset(10.981936007480215, 33.748333697953704),
Offset(9.555732704094467, 31.474164989109738),
Offset(8.604094587551149, 29.240810674974632),
Offset(8.078971815972453, 27.319768299655923),
Offset(7.90012901995137, 26.300902958794232),
Offset(7.900000000000001, 26.3),
],
<Offset>[
Offset(40.1017721538407, 26.287560601558003),
Offset(40.05411260718566, 26.601051401991576),
Offset(39.719281395564664, 28.171833218988365),
Offset(38.999704515176084, 30.285607723792996),
Offset(37.82439398905538, 32.566570541084076),
Offset(36.17021727910478, 34.78822558993737),
Offset(34.04812292097352, 36.788089214773514),
Offset(31.52481132468762, 38.417947653111135),
Offset(28.66888336178518, 39.57888083766114),
Offset(25.61897084762229, 40.18267386418417),
Offset(22.50989071854255, 40.1950478334988),
Offset(19.455268773269847, 39.61555052109223),
Offset(16.566740557627305, 38.46536048850415),
Offset(13.94987148363671, 36.786513082329414),
Offset(11.750592788146463, 34.69822522468986),
Offset(10.00655460227816, 32.287550054206456),
Offset(8.773125131753968, 29.713342432130013),
Offset(8.040737198979963, 27.130803546691798),
Offset(7.7525038150562064, 24.720324732489967),
Offset(7.7862778194298965, 22.729089676141975),
Offset(7.899871030690932, 21.700902966028845),
Offset(7.900000000000001, 21.7),
],
<Offset>[
Offset(40.1017721538407, 26.287560601558003),
Offset(40.05411260718566, 26.601051401991576),
Offset(39.719281395564664, 28.171833218988365),
Offset(38.999704515176084, 30.285607723792996),
Offset(37.82439398905538, 32.566570541084076),
Offset(36.17021727910478, 34.78822558993737),
Offset(34.04812292097352, 36.788089214773514),
Offset(31.52481132468762, 38.417947653111135),
Offset(28.66888336178518, 39.57888083766114),
Offset(25.61897084762229, 40.18267386418417),
Offset(22.50989071854255, 40.1950478334988),
Offset(19.455268773269847, 39.61555052109223),
Offset(16.566740557627305, 38.46536048850415),
Offset(13.94987148363671, 36.786513082329414),
Offset(11.750592788146463, 34.69822522468986),
Offset(10.00655460227816, 32.287550054206456),
Offset(8.773125131753968, 29.713342432130013),
Offset(8.040737198979963, 27.130803546691798),
Offset(7.7525038150562064, 24.720324732489967),
Offset(7.7862778194298965, 22.729089676141975),
Offset(7.899871030690932, 21.700902966028845),
Offset(7.900000000000001, 21.7),
],
),
_PathCubicTo(
<Offset>[
Offset(40.1017721538407, 26.287560601558003),
Offset(40.05411260718566, 26.601051401991576),
Offset(39.719281395564664, 28.171833218988365),
Offset(38.999704515176084, 30.285607723792996),
Offset(37.82439398905538, 32.566570541084076),
Offset(36.17021727910478, 34.78822558993737),
Offset(34.04812292097352, 36.788089214773514),
Offset(31.52481132468762, 38.417947653111135),
Offset(28.66888336178518, 39.57888083766114),
Offset(25.61897084762229, 40.18267386418417),
Offset(22.50989071854255, 40.1950478334988),
Offset(19.455268773269847, 39.61555052109223),
Offset(16.566740557627305, 38.46536048850415),
Offset(13.94987148363671, 36.786513082329414),
Offset(11.750592788146463, 34.69822522468986),
Offset(10.00655460227816, 32.287550054206456),
Offset(8.773125131753968, 29.713342432130013),
Offset(8.040737198979963, 27.130803546691798),
Offset(7.7525038150562064, 24.720324732489967),
Offset(7.7862778194298965, 22.729089676141975),
Offset(7.899871030690932, 21.700902966028845),
Offset(7.900000000000001, 21.7),
],
<Offset>[
Offset(44.701770780978414, 26.284006683840616),
Offset(44.65330619327731, 26.68718129026179),
Offset(44.2875535150823, 28.71117526448252),
Offset(43.45104608837711, 31.445589705847993),
Offset(42.03788712763425, 34.412234533025405),
Offset(40.009407140851614, 37.32212006395564),
Offset(37.37312090743705, 39.96682927807115),
Offset(34.208476401724596, 42.15398054299475),
Offset(30.599325936591477, 43.754212137734854),
Offset(26.719589639523896, 44.649063712250836),
Offset(22.740462033074415, 44.789265598136765),
Offset(18.807366050629092, 44.16969391606726),
Offset(15.064042333303117, 42.81299180298022),
Offset(11.647296022348167, 40.76874188603618),
Offset(8.748687777815066, 38.183704576077155),
Offset(6.419891893084303, 35.16780188529314),
Offset(4.73813386593028, 31.92215330785626),
Offset(3.6973757565620238, 28.6457990518063),
Offset(3.2320178725715425, 25.571915504984908),
Offset(3.195599195915945, 23.02178367268453),
Offset(3.2998710379255467, 21.701160955289282),
Offset(3.3000000000000016, 21.7),
],
<Offset>[
Offset(44.701770780978414, 26.284006683840616),
Offset(44.65330619327731, 26.68718129026179),
Offset(44.2875535150823, 28.71117526448252),
Offset(43.45104608837711, 31.445589705847993),
Offset(42.03788712763425, 34.412234533025405),
Offset(40.009407140851614, 37.32212006395564),
Offset(37.37312090743705, 39.96682927807115),
Offset(34.208476401724596, 42.15398054299475),
Offset(30.599325936591477, 43.754212137734854),
Offset(26.719589639523896, 44.649063712250836),
Offset(22.740462033074415, 44.789265598136765),
Offset(18.807366050629092, 44.16969391606726),
Offset(15.064042333303117, 42.81299180298022),
Offset(11.647296022348167, 40.76874188603618),
Offset(8.748687777815066, 38.183704576077155),
Offset(6.419891893084303, 35.16780188529314),
Offset(4.73813386593028, 31.92215330785626),
Offset(3.6973757565620238, 28.6457990518063),
Offset(3.2320178725715425, 25.571915504984908),
Offset(3.195599195915945, 23.02178367268453),
Offset(3.2998710379255467, 21.701160955289282),
Offset(3.3000000000000016, 21.7),
],
),
_PathCubicTo(
<Offset>[
Offset(44.701770780978414, 26.284006683840616),
Offset(44.65330619327731, 26.68718129026179),
Offset(44.2875535150823, 28.71117526448252),
Offset(43.45104608837711, 31.445589705847993),
Offset(42.03788712763425, 34.412234533025405),
Offset(40.009407140851614, 37.32212006395564),
Offset(37.37312090743705, 39.96682927807115),
Offset(34.208476401724596, 42.15398054299475),
Offset(30.599325936591477, 43.754212137734854),
Offset(26.719589639523896, 44.649063712250836),
Offset(22.740462033074415, 44.789265598136765),
Offset(18.807366050629092, 44.16969391606726),
Offset(15.064042333303117, 42.81299180298022),
Offset(11.647296022348167, 40.76874188603618),
Offset(8.748687777815066, 38.183704576077155),
Offset(6.419891893084303, 35.16780188529314),
Offset(4.73813386593028, 31.92215330785626),
Offset(3.6973757565620238, 28.6457990518063),
Offset(3.2320178725715425, 25.571915504984908),
Offset(3.195599195915945, 23.02178367268453),
Offset(3.2998710379255467, 21.701160955289282),
Offset(3.3000000000000016, 21.7),
],
<Offset>[
Offset(44.698216863261024, 21.684008056702904),
Offset(44.739436081547524, 22.08798770417014),
Offset(44.82689556057646, 24.14290314496488),
Offset(44.611028070432106, 26.99424813264697),
Offset(43.88355111957557, 30.19874139444654),
Offset(42.54330161486988, 33.482930202208806),
Offset(40.55186097073469, 36.64183129160762),
Offset(37.94450929160821, 39.470315465957775),
Offset(34.77465723666519, 41.823769562928554),
Offset(31.18597948759057, 43.548444920349226),
Offset(27.334679797712376, 44.5586942836049),
Offset(23.361509445604124, 44.81759663870801),
Offset(19.41167364777919, 44.315690027304406),
Offset(15.629524826054936, 43.07131734732473),
Offset(12.234167129202369, 41.18560958640855),
Offset(9.300143724170985, 38.754464594487),
Offset(6.946944741656527, 35.95714457367995),
Offset(5.2123712616765285, 32.989160494224244),
Offset(4.0836086450664855, 30.092401447469573),
Offset(3.4882931924585017, 27.61246229619848),
Offset(3.300129027185985, 26.30116094805467),
Offset(3.3000000000000016, 26.3),
],
<Offset>[
Offset(44.698216863261024, 21.684008056702904),
Offset(44.739436081547524, 22.08798770417014),
Offset(44.82689556057646, 24.14290314496488),
Offset(44.611028070432106, 26.99424813264697),
Offset(43.88355111957557, 30.19874139444654),
Offset(42.54330161486988, 33.482930202208806),
Offset(40.55186097073469, 36.64183129160762),
Offset(37.94450929160821, 39.470315465957775),
Offset(34.77465723666519, 41.823769562928554),
Offset(31.18597948759057, 43.548444920349226),
Offset(27.334679797712376, 44.5586942836049),
Offset(23.361509445604124, 44.81759663870801),
Offset(19.41167364777919, 44.315690027304406),
Offset(15.629524826054936, 43.07131734732473),
Offset(12.234167129202369, 41.18560958640855),
Offset(9.300143724170985, 38.754464594487),
Offset(6.946944741656527, 35.95714457367995),
Offset(5.2123712616765285, 32.989160494224244),
Offset(4.0836086450664855, 30.092401447469573),
Offset(3.4882931924585017, 27.61246229619848),
Offset(3.300129027185985, 26.30116094805467),
Offset(3.3000000000000016, 26.3),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(35.49111177355083, 12.491118637862245),
Offset(35.71330868590466, 12.717340755446422),
Offset(36.76903541252949, 13.927674814941295),
Offset(38.028308888140046, 15.771601022134929),
Offset(39.14789282630049, 18.080427133406147),
Offset(39.93271083941276, 20.736761530678603),
Offset(40.25934512440292, 23.63435519208529),
Offset(40.04924491730148, 26.630919532116586),
Offset(39.264434687200016, 29.612221813168535),
Offset(37.917521599920704, 32.41442764041267),
Offset(36.061972697924574, 34.909116125265236),
Offset(33.765601680835694, 37.005115294039456),
Offset(31.112332725379705, 38.625823847000646),
Offset(28.199133356045557, 39.71201066248828),
Offset(25.20893585263977, 40.21846090429675),
Offset(22.23397280473206, 40.167286350701346),
Offset(19.4345490247564, 39.60950535387484),
Offset(16.929085156741415, 38.64589236883111),
Offset(14.827762075025696, 37.430191787449026),
Offset(13.255038432571515, 36.20843155014127),
Offset(12.500644991237632, 35.50064495506456),
Offset(12.5, 35.5),
],
),
_PathCubicTo(
<Offset>[
Offset(35.49111177355083, 12.491118637862245),
Offset(35.71330868590466, 12.717340755446422),
Offset(36.76903541252949, 13.927674814941295),
Offset(38.028308888140046, 15.771601022134929),
Offset(39.14789282630049, 18.080427133406147),
Offset(39.93271083941276, 20.736761530678603),
Offset(40.25934512440292, 23.63435519208529),
Offset(40.04924491730148, 26.630919532116586),
Offset(39.264434687200016, 29.612221813168535),
Offset(37.917521599920704, 32.41442764041267),
Offset(36.061972697924574, 34.909116125265236),
Offset(33.765601680835694, 37.005115294039456),
Offset(31.112332725379705, 38.625823847000646),
Offset(28.199133356045557, 39.71201066248828),
Offset(25.20893585263977, 40.21846090429675),
Offset(22.23397280473206, 40.167286350701346),
Offset(19.4345490247564, 39.60950535387484),
Offset(16.929085156741415, 38.64589236883111),
Offset(14.827762075025696, 37.430191787449026),
Offset(13.255038432571515, 36.20843155014127),
Offset(12.500644991237632, 35.50064495506456),
Offset(12.5, 35.5),
],
<Offset>[
Offset(3.2911213835868267, 12.515996061883946),
Offset(3.5189535832631194, 12.114431537554925),
Offset(4.791130575906015, 10.152280496482213),
Offset(6.868917875732878, 7.651727147749964),
Offset(9.653440856248416, 5.16077918981685),
Offset(13.05838180718493, 2.9995002125507035),
Offset(16.984359219158236, 1.3831747490018031),
Offset(21.26358937804263, 0.47868930293129175),
Offset(25.751336663555943, 0.38490271265255416),
Offset(30.21319005660945, 1.1496987039459512),
Offset(34.44797349620151, 2.7495917727994907),
Offset(38.30092073932097, 5.126111529214247),
Offset(41.63122029564902, 8.192404645668148),
Offset(44.317161585065364, 11.836409036540893),
Offset(46.222270924959545, 15.820105444585629),
Offset(47.34061176908905, 20.005523533094575),
Offset(47.67948788552222, 24.147829223791117),
Offset(47.33261525366699, 28.040923833029577),
Offset(46.47116367241834, 31.469056379984426),
Offset(45.389788797169174, 34.15957357434337),
Offset(44.700644940595325, 35.49883903024149),
Offset(44.699999999999996, 35.5),
],
<Offset>[
Offset(3.2911213835868267, 12.515996061883946),
Offset(3.5189535832631194, 12.114431537554925),
Offset(4.791130575906015, 10.152280496482213),
Offset(6.868917875732878, 7.651727147749964),
Offset(9.653440856248416, 5.16077918981685),
Offset(13.05838180718493, 2.9995002125507035),
Offset(16.984359219158236, 1.3831747490018031),
Offset(21.26358937804263, 0.47868930293129175),
Offset(25.751336663555943, 0.38490271265255416),
Offset(30.21319005660945, 1.1496987039459512),
Offset(34.44797349620151, 2.7495917727994907),
Offset(38.30092073932097, 5.126111529214247),
Offset(41.63122029564902, 8.192404645668148),
Offset(44.317161585065364, 11.836409036540893),
Offset(46.222270924959545, 15.820105444585629),
Offset(47.34061176908905, 20.005523533094575),
Offset(47.67948788552222, 24.147829223791117),
Offset(47.33261525366699, 28.040923833029577),
Offset(46.47116367241834, 31.469056379984426),
Offset(45.389788797169174, 34.15957357434337),
Offset(44.700644940595325, 35.49883903024149),
Offset(44.699999999999996, 35.5),
],
),
_PathCubicTo(
<Offset>[
Offset(3.2911213835868267, 12.515996061883946),
Offset(3.5189535832631194, 12.114431537554925),
Offset(4.791130575906015, 10.152280496482213),
Offset(6.868917875732878, 7.651727147749964),
Offset(9.653440856248416, 5.16077918981685),
Offset(13.05838180718493, 2.9995002125507035),
Offset(16.984359219158236, 1.3831747490018031),
Offset(21.26358937804263, 0.47868930293129175),
Offset(25.751336663555943, 0.38490271265255416),
Offset(30.21319005660945, 1.1496987039459512),
Offset(34.44797349620151, 2.7495917727994907),
Offset(38.30092073932097, 5.126111529214247),
Offset(41.63122029564902, 8.192404645668148),
Offset(44.317161585065364, 11.836409036540893),
Offset(46.222270924959545, 15.820105444585629),
Offset(47.34061176908905, 20.005523533094575),
Offset(47.67948788552222, 24.147829223791117),
Offset(47.33261525366699, 28.040923833029577),
Offset(46.47116367241834, 31.469056379984426),
Offset(45.389788797169174, 34.15957357434337),
Offset(44.700644940595325, 35.49883903024149),
Offset(44.699999999999996, 35.5),
],
<Offset>[
Offset(3.29467530130421, 17.11599468902166),
Offset(3.432823694992905, 16.713625123646572),
Offset(4.2517885304118614, 14.720552615999853),
Offset(5.708935893677882, 12.103068720950988),
Offset(7.807776864307087, 9.374272328395719),
Offset(10.524487333166658, 6.838690074297536),
Offset(13.805619155860596, 4.708172735465329),
Offset(17.52755648815902, 3.162354379968269),
Offset(21.57600536348223, 2.3153452874588503),
Offset(25.746800208542776, 2.2503174958475576),
Offset(29.853755731563552, 2.9801630873313556),
Offset(33.74677734434594, 4.478208806573495),
Offset(37.28358898117295, 6.68970642134396),
Offset(40.334932781358596, 9.533833575252348),
Offset(42.73679157357225, 12.81820043425423),
Offset(44.46035993800237, 16.41886082390072),
Offset(45.47067700979597, 20.11283795796743),
Offset(45.81761974855248, 23.697562390611637),
Offset(45.619572899923405, 26.94857043749976),
Offset(45.097094800626614, 29.568894950829417),
Offset(44.70038695133489, 30.898839037476105),
Offset(44.699999999999996, 30.900000000000002),
],
<Offset>[
Offset(3.29467530130421, 17.11599468902166),
Offset(3.432823694992905, 16.713625123646572),
Offset(4.2517885304118614, 14.720552615999853),
Offset(5.708935893677882, 12.103068720950988),
Offset(7.807776864307087, 9.374272328395719),
Offset(10.524487333166658, 6.838690074297536),
Offset(13.805619155860596, 4.708172735465329),
Offset(17.52755648815902, 3.162354379968269),
Offset(21.57600536348223, 2.3153452874588503),
Offset(25.746800208542776, 2.2503174958475576),
Offset(29.853755731563552, 2.9801630873313556),
Offset(33.74677734434594, 4.478208806573495),
Offset(37.28358898117295, 6.68970642134396),
Offset(40.334932781358596, 9.533833575252348),
Offset(42.73679157357225, 12.81820043425423),
Offset(44.46035993800237, 16.41886082390072),
Offset(45.47067700979597, 20.11283795796743),
Offset(45.81761974855248, 23.697562390611637),
Offset(45.619572899923405, 26.94857043749976),
Offset(45.097094800626614, 29.568894950829417),
Offset(44.70038695133489, 30.898839037476105),
Offset(44.699999999999996, 30.900000000000002),
],
),
_PathCubicTo(
<Offset>[
Offset(3.29467530130421, 17.11599468902166),
Offset(3.432823694992905, 16.713625123646572),
Offset(4.2517885304118614, 14.720552615999853),
Offset(5.708935893677882, 12.103068720950988),
Offset(7.807776864307087, 9.374272328395719),
Offset(10.524487333166658, 6.838690074297536),
Offset(13.805619155860596, 4.708172735465329),
Offset(17.52755648815902, 3.162354379968269),
Offset(21.57600536348223, 2.3153452874588503),
Offset(25.746800208542776, 2.2503174958475576),
Offset(29.853755731563552, 2.9801630873313556),
Offset(33.74677734434594, 4.478208806573495),
Offset(37.28358898117295, 6.68970642134396),
Offset(40.334932781358596, 9.533833575252348),
Offset(42.73679157357225, 12.81820043425423),
Offset(44.46035993800237, 16.41886082390072),
Offset(45.47067700979597, 20.11283795796743),
Offset(45.81761974855248, 23.697562390611637),
Offset(45.619572899923405, 26.94857043749976),
Offset(45.097094800626614, 29.568894950829417),
Offset(44.70038695133489, 30.898839037476105),
Offset(44.699999999999996, 30.900000000000002),
],
<Offset>[
Offset(35.49466569126821, 17.09111726499996),
Offset(35.62717879763444, 17.31653434153807),
Offset(36.22969336703533, 18.495946934458935),
Offset(36.86832690608505, 20.22294259533595),
Offset(37.30222883435916, 22.293920271985016),
Offset(37.39881636539449, 24.575951392425434),
Offset(37.08060506110528, 26.959353178548817),
Offset(36.31321202741787, 29.314584609153563),
Offset(35.08910338712631, 31.54266438797483),
Offset(33.45113175185403, 33.51504643231427),
Offset(31.46775493328661, 35.1396874397971),
Offset(29.21145828586066, 36.357212571398705),
Offset(26.764701410903633, 37.123125622676454),
Offset(24.21690455233879, 37.409435201199734),
Offset(21.72345650125247, 37.21655589396535),
Offset(19.353720973645377, 36.580623641507486),
Offset(17.225738149030153, 35.574514088051146),
Offset(15.414089651626908, 34.30253092641317),
Offset(13.976171302530755, 32.90970584496436),
Offset(12.962344436028957, 31.61775292662732),
Offset(12.500387001977192, 30.900644962299175),
Offset(12.5, 30.900000000000002),
],
<Offset>[
Offset(35.49466569126821, 17.09111726499996),
Offset(35.62717879763444, 17.31653434153807),
Offset(36.22969336703533, 18.495946934458935),
Offset(36.86832690608505, 20.22294259533595),
Offset(37.30222883435916, 22.293920271985016),
Offset(37.39881636539449, 24.575951392425434),
Offset(37.08060506110528, 26.959353178548817),
Offset(36.31321202741787, 29.314584609153563),
Offset(35.08910338712631, 31.54266438797483),
Offset(33.45113175185403, 33.51504643231427),
Offset(31.46775493328661, 35.1396874397971),
Offset(29.21145828586066, 36.357212571398705),
Offset(26.764701410903633, 37.123125622676454),
Offset(24.21690455233879, 37.409435201199734),
Offset(21.72345650125247, 37.21655589396535),
Offset(19.353720973645377, 36.580623641507486),
Offset(17.225738149030153, 35.574514088051146),
Offset(15.414089651626908, 34.30253092641317),
Offset(13.976171302530755, 32.90970584496436),
Offset(12.962344436028957, 31.61775292662732),
Offset(12.500387001977192, 30.900644962299175),
Offset(12.5, 30.900000000000002),
],
),
_PathCubicTo(
<Offset>[
Offset(35.49466569126821, 17.09111726499996),
Offset(35.62717879763444, 17.31653434153807),
Offset(36.22969336703533, 18.495946934458935),
Offset(36.86832690608505, 20.22294259533595),
Offset(37.30222883435916, 22.293920271985016),
Offset(37.39881636539449, 24.575951392425434),
Offset(37.08060506110528, 26.959353178548817),
Offset(36.31321202741787, 29.314584609153563),
Offset(35.08910338712631, 31.54266438797483),
Offset(33.45113175185403, 33.51504643231427),
Offset(31.46775493328661, 35.1396874397971),
Offset(29.21145828586066, 36.357212571398705),
Offset(26.764701410903633, 37.123125622676454),
Offset(24.21690455233879, 37.409435201199734),
Offset(21.72345650125247, 37.21655589396535),
Offset(19.353720973645377, 36.580623641507486),
Offset(17.225738149030153, 35.574514088051146),
Offset(15.414089651626908, 34.30253092641317),
Offset(13.976171302530755, 32.90970584496436),
Offset(12.962344436028957, 31.61775292662732),
Offset(12.500387001977192, 30.900644962299175),
Offset(12.5, 30.900000000000002),
],
<Offset>[
Offset(35.49111177355083, 12.491118637862245),
Offset(35.71330868590466, 12.717340755446422),
Offset(36.76903541252949, 13.927674814941295),
Offset(38.028308888140046, 15.771601022134929),
Offset(39.14789282630049, 18.080427133406147),
Offset(39.93271083941276, 20.736761530678603),
Offset(40.25934512440292, 23.63435519208529),
Offset(40.04924491730148, 26.630919532116586),
Offset(39.264434687200016, 29.612221813168535),
Offset(37.917521599920704, 32.41442764041267),
Offset(36.061972697924574, 34.909116125265236),
Offset(33.765601680835694, 37.005115294039456),
Offset(31.112332725379705, 38.625823847000646),
Offset(28.199133356045557, 39.71201066248828),
Offset(25.20893585263977, 40.21846090429675),
Offset(22.23397280473206, 40.167286350701346),
Offset(19.4345490247564, 39.60950535387484),
Offset(16.929085156741415, 38.64589236883111),
Offset(14.827762075025696, 37.430191787449026),
Offset(13.255038432571515, 36.20843155014127),
Offset(12.500644991237632, 35.50064495506456),
Offset(12.5, 35.5),
],
<Offset>[
Offset(35.49111177355083, 12.491118637862245),
Offset(35.71330868590466, 12.717340755446422),
Offset(36.76903541252949, 13.927674814941295),
Offset(38.028308888140046, 15.771601022134929),
Offset(39.14789282630049, 18.080427133406147),
Offset(39.93271083941276, 20.736761530678603),
Offset(40.25934512440292, 23.63435519208529),
Offset(40.04924491730148, 26.630919532116586),
Offset(39.264434687200016, 29.612221813168535),
Offset(37.917521599920704, 32.41442764041267),
Offset(36.061972697924574, 34.909116125265236),
Offset(33.765601680835694, 37.005115294039456),
Offset(31.112332725379705, 38.625823847000646),
Offset(28.199133356045557, 39.71201066248828),
Offset(25.20893585263977, 40.21846090429675),
Offset(22.23397280473206, 40.167286350701346),
Offset(19.4345490247564, 39.60950535387484),
Offset(16.929085156741415, 38.64589236883111),
Offset(14.827762075025696, 37.430191787449026),
Offset(13.255038432571515, 36.20843155014127),
Offset(12.500644991237632, 35.50064495506456),
Offset(12.5, 35.5),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(35.50532744442037, 30.891113146413097),
Offset(35.3687891328238, 31.114115099813013),
Offset(34.61166723055287, 32.200763293011846),
Offset(33.38838095992007, 33.576967314939026),
Offset(31.76523685853518, 34.93439968772162),
Offset(29.797132943339673, 36.093520977665925),
Offset(27.54438487121236, 36.9343471379394),
Offset(25.105113357767024, 37.3655798402645),
Offset(22.563109486905173, 37.333992112393716),
Offset(20.051962207654007, 36.816902808019094),
Offset(17.68510163937272, 35.8314013833927),
Offset(15.549028100935569, 34.41350440347644),
Offset(13.721807467475426, 32.61503094970389),
Offset(12.270218141218486, 30.5017088173341),
Offset(11.267018447090559, 28.21084086297116),
Offset(10.71296548038534, 25.820635513925914),
Offset(10.599305521851413, 23.469540290580085),
Offset(10.869103136283398, 21.272446599159352),
Offset(11.421398985045926, 19.348248017510365),
Offset(12.084262446401288, 17.84571705608547),
Offset(12.499613034195878, 17.100644984003022),
Offset(12.5, 17.1),
],
),
_PathCubicTo(
<Offset>[
Offset(35.50532744442037, 30.891113146413097),
Offset(35.3687891328238, 31.114115099813013),
Offset(34.61166723055287, 32.200763293011846),
Offset(33.38838095992007, 33.576967314939026),
Offset(31.76523685853518, 34.93439968772162),
Offset(29.797132943339673, 36.093520977665925),
Offset(27.54438487121236, 36.9343471379394),
Offset(25.105113357767024, 37.3655798402645),
Offset(22.563109486905173, 37.333992112393716),
Offset(20.051962207654007, 36.816902808019094),
Offset(17.68510163937272, 35.8314013833927),
Offset(15.549028100935569, 34.41350440347644),
Offset(13.721807467475426, 32.61503094970389),
Offset(12.270218141218486, 30.5017088173341),
Offset(11.267018447090559, 28.21084086297116),
Offset(10.71296548038534, 25.820635513925914),
Offset(10.599305521851413, 23.469540290580085),
Offset(10.869103136283398, 21.272446599159352),
Offset(11.421398985045926, 19.348248017510365),
Offset(12.084262446401288, 17.84571705608547),
Offset(12.499613034195878, 17.100644984003022),
Offset(12.5, 17.1),
],
<Offset>[
Offset(3.3053370544563663, 30.9159905704348),
Offset(3.174434030182262, 30.511205881921516),
Offset(2.6337623939293966, 28.42536897455276),
Offset(2.2289899475128987, 25.45709344055406),
Offset(2.270784888483103, 22.014751744132322),
Offset(2.922803911111842, 18.35625965953803),
Offset(4.269398965967673, 14.683166694855906),
Offset(6.3194578185081784, 11.213349611079208),
Offset(9.0500114632611, 8.106673011877739),
Offset(12.347630664342756, 5.552173871552384),
Offset(16.071102437649664, 3.6718770309269573),
Offset(20.084347159420847, 2.534500638651229),
Offset(24.240695037744743, 2.181611748371399),
Offset(28.388246370238292, 2.6261071913867156),
Offset(32.28035351941033, 3.812485403260041),
Offset(35.81960444474234, 5.658872696319149),
Offset(38.844244382617234, 8.007864160496363),
Offset(41.27263323320897, 10.667478063357821),
Offset(43.06480058243858, 13.387112610045765),
Offset(44.21901281099895, 15.796859080287568),
Offset(44.69961298355358, 17.09883905917995),
Offset(44.699999999999996, 17.1),
],
<Offset>[
Offset(3.3053370544563663, 30.9159905704348),
Offset(3.174434030182262, 30.511205881921516),
Offset(2.6337623939293966, 28.42536897455276),
Offset(2.2289899475128987, 25.45709344055406),
Offset(2.270784888483103, 22.014751744132322),
Offset(2.922803911111842, 18.35625965953803),
Offset(4.269398965967673, 14.683166694855906),
Offset(6.3194578185081784, 11.213349611079208),
Offset(9.0500114632611, 8.106673011877739),
Offset(12.347630664342756, 5.552173871552384),
Offset(16.071102437649664, 3.6718770309269573),
Offset(20.084347159420847, 2.534500638651229),
Offset(24.240695037744743, 2.181611748371399),
Offset(28.388246370238292, 2.6261071913867156),
Offset(32.28035351941033, 3.812485403260041),
Offset(35.81960444474234, 5.658872696319149),
Offset(38.844244382617234, 8.007864160496363),
Offset(41.27263323320897, 10.667478063357821),
Offset(43.06480058243858, 13.387112610045765),
Offset(44.21901281099895, 15.796859080287568),
Offset(44.69961298355358, 17.09883905917995),
Offset(44.699999999999996, 17.1),
],
),
_PathCubicTo(
<Offset>[
Offset(3.3053370544563663, 30.9159905704348),
Offset(3.174434030182262, 30.511205881921516),
Offset(2.6337623939293966, 28.42536897455276),
Offset(2.2289899475128987, 25.45709344055406),
Offset(2.270784888483103, 22.014751744132322),
Offset(2.922803911111842, 18.35625965953803),
Offset(4.269398965967673, 14.683166694855906),
Offset(6.3194578185081784, 11.213349611079208),
Offset(9.0500114632611, 8.106673011877739),
Offset(12.347630664342756, 5.552173871552384),
Offset(16.071102437649664, 3.6718770309269573),
Offset(20.084347159420847, 2.534500638651229),
Offset(24.240695037744743, 2.181611748371399),
Offset(28.388246370238292, 2.6261071913867156),
Offset(32.28035351941033, 3.812485403260041),
Offset(35.81960444474234, 5.658872696319149),
Offset(38.844244382617234, 8.007864160496363),
Offset(41.27263323320897, 10.667478063357821),
Offset(43.06480058243858, 13.387112610045765),
Offset(44.21901281099895, 15.796859080287568),
Offset(44.69961298355358, 17.09883905917995),
Offset(44.699999999999996, 17.1),
],
<Offset>[
Offset(3.3088909721737494, 35.515989197572516),
Offset(3.0883041419120474, 35.11039946801316),
Offset(2.094420348435243, 32.9936410940704),
Offset(1.069007965457903, 29.90843501375508),
Offset(0.4251208965417739, 26.22824488271119),
Offset(0.3889094370935702, 22.19544952128486),
Offset(1.0906589026700306, 18.008164681319432),
Offset(2.5834249286245647, 13.897014688116185),
Offset(4.874680163187389, 10.037115586684035),
Offset(7.881240816276082, 6.65279266345399),
Offset(11.4768846730117, 3.902448345458822),
Offset(15.530203764445819, 1.8865979160104764),
Offset(19.89306372326867, 0.6789135240472106),
Offset(24.406017566531524, 0.32353173009817127),
Offset(28.794874168023036, 0.8105803929286424),
Offset(32.93935261365566, 2.0722099871252926),
Offset(36.63543350689098, 3.9728728946726743),
Offset(39.757637728094466, 6.324116620939881),
Offset(42.213209809943635, 8.866626667561102),
Offset(43.92631881445639, 11.206180456773618),
Offset(44.69935499429313, 12.498839066414565),
Offset(44.699999999999996, 12.5),
],
<Offset>[
Offset(3.3088909721737494, 35.515989197572516),
Offset(3.0883041419120474, 35.11039946801316),
Offset(2.094420348435243, 32.9936410940704),
Offset(1.069007965457903, 29.90843501375508),
Offset(0.4251208965417739, 26.22824488271119),
Offset(0.3889094370935702, 22.19544952128486),
Offset(1.0906589026700306, 18.008164681319432),
Offset(2.5834249286245647, 13.897014688116185),
Offset(4.874680163187389, 10.037115586684035),
Offset(7.881240816276082, 6.65279266345399),
Offset(11.4768846730117, 3.902448345458822),
Offset(15.530203764445819, 1.8865979160104764),
Offset(19.89306372326867, 0.6789135240472106),
Offset(24.406017566531524, 0.32353173009817127),
Offset(28.794874168023036, 0.8105803929286424),
Offset(32.93935261365566, 2.0722099871252926),
Offset(36.63543350689098, 3.9728728946726743),
Offset(39.757637728094466, 6.324116620939881),
Offset(42.213209809943635, 8.866626667561102),
Offset(43.92631881445639, 11.206180456773618),
Offset(44.69935499429313, 12.498839066414565),
Offset(44.699999999999996, 12.5),
],
),
_PathCubicTo(
<Offset>[
Offset(3.3088909721737494, 35.515989197572516),
Offset(3.0883041419120474, 35.11039946801316),
Offset(2.094420348435243, 32.9936410940704),
Offset(1.069007965457903, 29.90843501375508),
Offset(0.4251208965417739, 26.22824488271119),
Offset(0.3889094370935702, 22.19544952128486),
Offset(1.0906589026700306, 18.008164681319432),
Offset(2.5834249286245647, 13.897014688116185),
Offset(4.874680163187389, 10.037115586684035),
Offset(7.881240816276082, 6.65279266345399),
Offset(11.4768846730117, 3.902448345458822),
Offset(15.530203764445819, 1.8865979160104764),
Offset(19.89306372326867, 0.6789135240472106),
Offset(24.406017566531524, 0.32353173009817127),
Offset(28.794874168023036, 0.8105803929286424),
Offset(32.93935261365566, 2.0722099871252926),
Offset(36.63543350689098, 3.9728728946726743),
Offset(39.757637728094466, 6.324116620939881),
Offset(42.213209809943635, 8.866626667561102),
Offset(43.92631881445639, 11.206180456773618),
Offset(44.69935499429313, 12.498839066414565),
Offset(44.699999999999996, 12.5),
],
<Offset>[
Offset(35.50888136213775, 35.49111177355081),
Offset(35.282659244553585, 35.713308685904664),
Offset(34.072325185058716, 36.76903541252948),
Offset(32.22839897786507, 38.028308888140046),
Offset(29.91957286659385, 39.14789282630049),
Offset(27.2632384693214, 39.93271083941276),
Offset(24.365644807914713, 40.25934512440292),
Offset(21.369080467883414, 40.04924491730148),
Offset(18.38777818683146, 39.264434687200016),
Offset(15.585572359587335, 37.917521599920704),
Offset(13.09088387473476, 36.06197269792457),
Offset(10.99488470596054, 33.76560168083569),
Offset(9.374176152999356, 31.112332725379705),
Offset(8.287989337511718, 28.199133356045557),
Offset(7.781539095703257, 25.208935852639762),
Offset(7.8327136492986575, 22.233972804732062),
Offset(8.390494646125166, 19.434549024756393),
Offset(9.354107631168892, 16.929085156741415),
Offset(10.569808212550985, 14.8277620750257),
Offset(11.79156844985873, 13.255038432571517),
Offset(12.499355044935438, 12.500644991237637),
Offset(12.5, 12.5),
],
<Offset>[
Offset(35.50888136213775, 35.49111177355081),
Offset(35.282659244553585, 35.713308685904664),
Offset(34.072325185058716, 36.76903541252948),
Offset(32.22839897786507, 38.028308888140046),
Offset(29.91957286659385, 39.14789282630049),
Offset(27.2632384693214, 39.93271083941276),
Offset(24.365644807914713, 40.25934512440292),
Offset(21.369080467883414, 40.04924491730148),
Offset(18.38777818683146, 39.264434687200016),
Offset(15.585572359587335, 37.917521599920704),
Offset(13.09088387473476, 36.06197269792457),
Offset(10.99488470596054, 33.76560168083569),
Offset(9.374176152999356, 31.112332725379705),
Offset(8.287989337511718, 28.199133356045557),
Offset(7.781539095703257, 25.208935852639762),
Offset(7.8327136492986575, 22.233972804732062),
Offset(8.390494646125166, 19.434549024756393),
Offset(9.354107631168892, 16.929085156741415),
Offset(10.569808212550985, 14.8277620750257),
Offset(11.79156844985873, 13.255038432571517),
Offset(12.499355044935438, 12.500644991237637),
Offset(12.5, 12.5),
],
),
_PathCubicTo(
<Offset>[
Offset(35.50888136213775, 35.49111177355081),
Offset(35.282659244553585, 35.713308685904664),
Offset(34.072325185058716, 36.76903541252948),
Offset(32.22839897786507, 38.028308888140046),
Offset(29.91957286659385, 39.14789282630049),
Offset(27.2632384693214, 39.93271083941276),
Offset(24.365644807914713, 40.25934512440292),
Offset(21.369080467883414, 40.04924491730148),
Offset(18.38777818683146, 39.264434687200016),
Offset(15.585572359587335, 37.917521599920704),
Offset(13.09088387473476, 36.06197269792457),
Offset(10.99488470596054, 33.76560168083569),
Offset(9.374176152999356, 31.112332725379705),
Offset(8.287989337511718, 28.199133356045557),
Offset(7.781539095703257, 25.208935852639762),
Offset(7.8327136492986575, 22.233972804732062),
Offset(8.390494646125166, 19.434549024756393),
Offset(9.354107631168892, 16.929085156741415),
Offset(10.569808212550985, 14.8277620750257),
Offset(11.79156844985873, 13.255038432571517),
Offset(12.499355044935438, 12.500644991237637),
Offset(12.5, 12.5),
],
<Offset>[
Offset(35.50532744442037, 30.891113146413097),
Offset(35.3687891328238, 31.114115099813013),
Offset(34.61166723055287, 32.200763293011846),
Offset(33.38838095992007, 33.576967314939026),
Offset(31.76523685853518, 34.93439968772162),
Offset(29.797132943339673, 36.093520977665925),
Offset(27.54438487121236, 36.9343471379394),
Offset(25.105113357767024, 37.3655798402645),
Offset(22.563109486905173, 37.333992112393716),
Offset(20.051962207654007, 36.816902808019094),
Offset(17.68510163937272, 35.8314013833927),
Offset(15.549028100935569, 34.41350440347644),
Offset(13.721807467475426, 32.61503094970389),
Offset(12.270218141218486, 30.5017088173341),
Offset(11.267018447090559, 28.21084086297116),
Offset(10.71296548038534, 25.820635513925914),
Offset(10.599305521851413, 23.469540290580085),
Offset(10.869103136283398, 21.272446599159352),
Offset(11.421398985045926, 19.348248017510365),
Offset(12.084262446401288, 17.84571705608547),
Offset(12.499613034195878, 17.100644984003022),
Offset(12.5, 17.1),
],
<Offset>[
Offset(35.50532744442037, 30.891113146413097),
Offset(35.3687891328238, 31.114115099813013),
Offset(34.61166723055287, 32.200763293011846),
Offset(33.38838095992007, 33.576967314939026),
Offset(31.76523685853518, 34.93439968772162),
Offset(29.797132943339673, 36.093520977665925),
Offset(27.54438487121236, 36.9343471379394),
Offset(25.105113357767024, 37.3655798402645),
Offset(22.563109486905173, 37.333992112393716),
Offset(20.051962207654007, 36.816902808019094),
Offset(17.68510163937272, 35.8314013833927),
Offset(15.549028100935569, 34.41350440347644),
Offset(13.721807467475426, 32.61503094970389),
Offset(12.270218141218486, 30.5017088173341),
Offset(11.267018447090559, 28.21084086297116),
Offset(10.71296548038534, 25.820635513925914),
Offset(10.599305521851413, 23.469540290580085),
Offset(10.869103136283398, 21.272446599159352),
Offset(11.421398985045926, 19.348248017510365),
Offset(12.084262446401288, 17.84571705608547),
Offset(12.499613034195878, 17.100644984003022),
Offset(12.5, 17.1),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.634146341463,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(35.4982196089856, 21.691115892137674),
Offset(35.54104890936423, 21.915727927629714),
Offset(35.69035132154117, 23.06421905397657),
Offset(35.70834492403006, 24.67428416853698),
Offset(35.45656484241783, 26.507413410563885),
Offset(34.86492189137621, 28.415141254172266),
Offset(33.901864997807635, 30.284351165012342),
Offset(32.57717913753425, 31.99824968619054),
Offset(30.913772087052596, 33.47310696278113),
Offset(28.984741903787356, 34.61566522421589),
Offset(26.873537168648646, 35.370258754328965),
Offset(24.65731489088563, 35.709309848757954),
Offset(22.41707009642756, 35.62042739835226),
Offset(20.23467574863202, 35.10685973991119),
Offset(18.23797714986516, 34.21465088363395),
Offset(16.473469142558695, 32.99396093231363),
Offset(15.016927273303907, 31.53952282222746),
Offset(13.899094146512402, 29.959169483995232),
Offset(13.124580530035814, 28.389219902479688),
Offset(12.669650439486402, 27.027074303113366),
Offset(12.500129012716759, 26.300644969533792),
Offset(12.5, 26.3),
],
),
_PathCubicTo(
<Offset>[
Offset(35.4982196089856, 21.691115892137674),
Offset(35.54104890936423, 21.915727927629714),
Offset(35.69035132154117, 23.06421905397657),
Offset(35.70834492403006, 24.67428416853698),
Offset(35.45656484241783, 26.507413410563885),
Offset(34.86492189137621, 28.415141254172266),
Offset(33.901864997807635, 30.284351165012342),
Offset(32.57717913753425, 31.99824968619054),
Offset(30.913772087052596, 33.47310696278113),
Offset(28.984741903787356, 34.61566522421589),
Offset(26.873537168648646, 35.370258754328965),
Offset(24.65731489088563, 35.709309848757954),
Offset(22.41707009642756, 35.62042739835226),
Offset(20.23467574863202, 35.10685973991119),
Offset(18.23797714986516, 34.21465088363395),
Offset(16.473469142558695, 32.99396093231363),
Offset(15.016927273303907, 31.53952282222746),
Offset(13.899094146512402, 29.959169483995232),
Offset(13.124580530035814, 28.389219902479688),
Offset(12.669650439486402, 27.027074303113366),
Offset(12.500129012716759, 26.300644969533792),
Offset(12.5, 26.3),
],
<Offset>[
Offset(3.2982292190216, 21.715993316159373),
Offset(3.3466938067226906, 21.312818709738217),
Offset(3.712446484917704, 19.288824735517487),
Offset(4.5489539116228865, 16.554410294152014),
Offset(5.962112872365758, 13.587765466974588),
Offset(7.990592859148386, 10.677879936044366),
Offset(10.626879092562953, 8.033170721928855),
Offset(13.791523598275406, 5.846019457005246),
Offset(17.400674063408523, 4.245787862265146),
Offset(21.280410360476104, 3.350936287749171),
Offset(25.25953796692559, 3.2107344018632205),
Offset(29.192633949370908, 3.8303060839327383),
Offset(32.93595766669688, 5.187008197019772),
Offset(36.35270397765183, 7.231258113963804),
Offset(39.251312222184936, 9.816295423922835),
Offset(41.58010810691569, 12.832198114706863),
Offset(43.26186613406972, 16.07784669214374),
Offset(44.302624243437975, 19.354200948193697),
Offset(44.76798212742847, 22.428084495015092),
Offset(44.80440080408406, 24.978216327315465),
Offset(44.70012896207446, 26.29883904471072),
Offset(44.699999999999996, 26.3),
],
<Offset>[
Offset(3.2982292190216, 21.715993316159373),
Offset(3.3466938067226906, 21.312818709738217),
Offset(3.712446484917704, 19.288824735517487),
Offset(4.5489539116228865, 16.554410294152014),
Offset(5.962112872365758, 13.587765466974588),
Offset(7.990592859148386, 10.677879936044366),
Offset(10.626879092562953, 8.033170721928855),
Offset(13.791523598275406, 5.846019457005246),
Offset(17.400674063408523, 4.245787862265146),
Offset(21.280410360476104, 3.350936287749171),
Offset(25.25953796692559, 3.2107344018632205),
Offset(29.192633949370908, 3.8303060839327383),
Offset(32.93595766669688, 5.187008197019772),
Offset(36.35270397765183, 7.231258113963804),
Offset(39.251312222184936, 9.816295423922835),
Offset(41.58010810691569, 12.832198114706863),
Offset(43.26186613406972, 16.07784669214374),
Offset(44.302624243437975, 19.354200948193697),
Offset(44.76798212742847, 22.428084495015092),
Offset(44.80440080408406, 24.978216327315465),
Offset(44.70012896207446, 26.29883904471072),
Offset(44.699999999999996, 26.3),
],
),
_PathCubicTo(
<Offset>[
Offset(3.2982292190216, 21.715993316159373),
Offset(3.3466938067226906, 21.312818709738217),
Offset(3.712446484917704, 19.288824735517487),
Offset(4.5489539116228865, 16.554410294152014),
Offset(5.962112872365758, 13.587765466974588),
Offset(7.990592859148386, 10.677879936044366),
Offset(10.626879092562953, 8.033170721928855),
Offset(13.791523598275406, 5.846019457005246),
Offset(17.400674063408523, 4.245787862265146),
Offset(21.280410360476104, 3.350936287749171),
Offset(25.25953796692559, 3.2107344018632205),
Offset(29.192633949370908, 3.8303060839327383),
Offset(32.93595766669688, 5.187008197019772),
Offset(36.35270397765183, 7.231258113963804),
Offset(39.251312222184936, 9.816295423922835),
Offset(41.58010810691569, 12.832198114706863),
Offset(43.26186613406972, 16.07784669214374),
Offset(44.302624243437975, 19.354200948193697),
Offset(44.76798212742847, 22.428084495015092),
Offset(44.80440080408406, 24.978216327315465),
Offset(44.70012896207446, 26.29883904471072),
Offset(44.699999999999996, 26.3),
],
<Offset>[
Offset(3.301783136738983, 26.315991943297085),
Offset(3.260563918452476, 25.912012295829864),
Offset(3.1731044394235504, 23.857096855035127),
Offset(3.388971929567891, 21.005751867353034),
Offset(4.116448880424429, 17.801258605553457),
Offset(5.456698385130114, 14.517069797791198),
Offset(7.448139029265311, 11.35816870839238),
Offset(10.055490708391792, 8.529684534042223),
Offset(13.225342763334812, 6.1762304370714425),
Offset(16.81402051240943, 4.4515550796507775),
Offset(20.665320202287624, 3.4413057163950853),
Offset(24.63849055439588, 3.1824033612919855),
Offset(28.588326352220808, 3.6843099726955835),
Offset(32.37047517394506, 4.92868265267526),
Offset(35.76583287079764, 6.814390413591436),
Offset(38.699856275829006, 9.245535405513007),
Offset(41.05305525834348, 12.042855426320052),
Offset(42.78762873832347, 15.010839505775758),
Offset(43.91639135493352, 17.90759855253043),
Offset(44.5117068075415, 20.387537703801513),
Offset(44.69987097281401, 21.698839051945335),
Offset(44.699999999999996, 21.7),
],
<Offset>[
Offset(3.301783136738983, 26.315991943297085),
Offset(3.260563918452476, 25.912012295829864),
Offset(3.1731044394235504, 23.857096855035127),
Offset(3.388971929567891, 21.005751867353034),
Offset(4.116448880424429, 17.801258605553457),
Offset(5.456698385130114, 14.517069797791198),
Offset(7.448139029265311, 11.35816870839238),
Offset(10.055490708391792, 8.529684534042223),
Offset(13.225342763334812, 6.1762304370714425),
Offset(16.81402051240943, 4.4515550796507775),
Offset(20.665320202287624, 3.4413057163950853),
Offset(24.63849055439588, 3.1824033612919855),
Offset(28.588326352220808, 3.6843099726955835),
Offset(32.37047517394506, 4.92868265267526),
Offset(35.76583287079764, 6.814390413591436),
Offset(38.699856275829006, 9.245535405513007),
Offset(41.05305525834348, 12.042855426320052),
Offset(42.78762873832347, 15.010839505775758),
Offset(43.91639135493352, 17.90759855253043),
Offset(44.5117068075415, 20.387537703801513),
Offset(44.69987097281401, 21.698839051945335),
Offset(44.699999999999996, 21.7),
],
),
_PathCubicTo(
<Offset>[
Offset(3.301783136738983, 26.315991943297085),
Offset(3.260563918452476, 25.912012295829864),
Offset(3.1731044394235504, 23.857096855035127),
Offset(3.388971929567891, 21.005751867353034),
Offset(4.116448880424429, 17.801258605553457),
Offset(5.456698385130114, 14.517069797791198),
Offset(7.448139029265311, 11.35816870839238),
Offset(10.055490708391792, 8.529684534042223),
Offset(13.225342763334812, 6.1762304370714425),
Offset(16.81402051240943, 4.4515550796507775),
Offset(20.665320202287624, 3.4413057163950853),
Offset(24.63849055439588, 3.1824033612919855),
Offset(28.588326352220808, 3.6843099726955835),
Offset(32.37047517394506, 4.92868265267526),
Offset(35.76583287079764, 6.814390413591436),
Offset(38.699856275829006, 9.245535405513007),
Offset(41.05305525834348, 12.042855426320052),
Offset(42.78762873832347, 15.010839505775758),
Offset(43.91639135493352, 17.90759855253043),
Offset(44.5117068075415, 20.387537703801513),
Offset(44.69987097281401, 21.698839051945335),
Offset(44.699999999999996, 21.7),
],
<Offset>[
Offset(35.50177352670298, 26.291114519275386),
Offset(35.454919021094014, 26.51492151372136),
Offset(35.15100927604702, 27.63249117349421),
Offset(34.54836294197506, 29.125625741738),
Offset(33.610900850476504, 30.720906549142754),
Offset(32.331027417357944, 32.2543311159191),
Offset(30.723124934509997, 33.60934915147587),
Offset(28.84114624765064, 34.68191476322752),
Offset(26.738440786978884, 35.40354953758742),
Offset(24.518352055720683, 35.71628401611749),
Offset(22.279319404010682, 35.60083006886083),
Offset(20.1031714959106, 35.061407126117196),
Offset(18.06943878195149, 34.11772917402808),
Offset(16.252446944925254, 32.804284278622646),
Offset(14.75249779847786, 31.212745873302556),
Offset(13.593217311472014, 29.407298223119774),
Offset(12.80811639757766, 27.504531556403773),
Offset(12.384098641397896, 25.615808041577292),
Offset(12.272989757540874, 23.868733959995026),
Offset(12.376956442943843, 22.436395679599414),
Offset(12.499871023456318, 21.700644976768405),
Offset(12.5, 21.7),
],
<Offset>[
Offset(35.50177352670298, 26.291114519275386),
Offset(35.454919021094014, 26.51492151372136),
Offset(35.15100927604702, 27.63249117349421),
Offset(34.54836294197506, 29.125625741738),
Offset(33.610900850476504, 30.720906549142754),
Offset(32.331027417357944, 32.2543311159191),
Offset(30.723124934509997, 33.60934915147587),
Offset(28.84114624765064, 34.68191476322752),
Offset(26.738440786978884, 35.40354953758742),
Offset(24.518352055720683, 35.71628401611749),
Offset(22.279319404010682, 35.60083006886083),
Offset(20.1031714959106, 35.061407126117196),
Offset(18.06943878195149, 34.11772917402808),
Offset(16.252446944925254, 32.804284278622646),
Offset(14.75249779847786, 31.212745873302556),
Offset(13.593217311472014, 29.407298223119774),
Offset(12.80811639757766, 27.504531556403773),
Offset(12.384098641397896, 25.615808041577292),
Offset(12.272989757540874, 23.868733959995026),
Offset(12.376956442943843, 22.436395679599414),
Offset(12.499871023456318, 21.700644976768405),
Offset(12.5, 21.7),
],
),
_PathCubicTo(
<Offset>[
Offset(35.50177352670298, 26.291114519275386),
Offset(35.454919021094014, 26.51492151372136),
Offset(35.15100927604702, 27.63249117349421),
Offset(34.54836294197506, 29.125625741738),
Offset(33.610900850476504, 30.720906549142754),
Offset(32.331027417357944, 32.2543311159191),
Offset(30.723124934509997, 33.60934915147587),
Offset(28.84114624765064, 34.68191476322752),
Offset(26.738440786978884, 35.40354953758742),
Offset(24.518352055720683, 35.71628401611749),
Offset(22.279319404010682, 35.60083006886083),
Offset(20.1031714959106, 35.061407126117196),
Offset(18.06943878195149, 34.11772917402808),
Offset(16.252446944925254, 32.804284278622646),
Offset(14.75249779847786, 31.212745873302556),
Offset(13.593217311472014, 29.407298223119774),
Offset(12.80811639757766, 27.504531556403773),
Offset(12.384098641397896, 25.615808041577292),
Offset(12.272989757540874, 23.868733959995026),
Offset(12.376956442943843, 22.436395679599414),
Offset(12.499871023456318, 21.700644976768405),
Offset(12.5, 21.7),
],
<Offset>[
Offset(35.4982196089856, 21.691115892137674),
Offset(35.54104890936423, 21.915727927629714),
Offset(35.69035132154117, 23.06421905397657),
Offset(35.70834492403006, 24.67428416853698),
Offset(35.45656484241783, 26.507413410563885),
Offset(34.86492189137621, 28.415141254172266),
Offset(33.901864997807635, 30.284351165012342),
Offset(32.57717913753425, 31.99824968619054),
Offset(30.913772087052596, 33.47310696278113),
Offset(28.984741903787356, 34.61566522421589),
Offset(26.873537168648646, 35.370258754328965),
Offset(24.65731489088563, 35.709309848757954),
Offset(22.41707009642756, 35.62042739835226),
Offset(20.23467574863202, 35.10685973991119),
Offset(18.23797714986516, 34.21465088363395),
Offset(16.473469142558695, 32.99396093231363),
Offset(15.016927273303907, 31.53952282222746),
Offset(13.899094146512402, 29.959169483995232),
Offset(13.124580530035814, 28.389219902479688),
Offset(12.669650439486402, 27.027074303113366),
Offset(12.500129012716759, 26.300644969533792),
Offset(12.5, 26.3),
],
<Offset>[
Offset(35.4982196089856, 21.691115892137674),
Offset(35.54104890936423, 21.915727927629714),
Offset(35.69035132154117, 23.06421905397657),
Offset(35.70834492403006, 24.67428416853698),
Offset(35.45656484241783, 26.507413410563885),
Offset(34.86492189137621, 28.415141254172266),
Offset(33.901864997807635, 30.284351165012342),
Offset(32.57717913753425, 31.99824968619054),
Offset(30.913772087052596, 33.47310696278113),
Offset(28.984741903787356, 34.61566522421589),
Offset(26.873537168648646, 35.370258754328965),
Offset(24.65731489088563, 35.709309848757954),
Offset(22.41707009642756, 35.62042739835226),
Offset(20.23467574863202, 35.10685973991119),
Offset(18.23797714986516, 34.21465088363395),
Offset(16.473469142558695, 32.99396093231363),
Offset(15.016927273303907, 31.53952282222746),
Offset(13.899094146512402, 29.959169483995232),
Offset(13.124580530035814, 28.389219902479688),
Offset(12.669650439486402, 27.027074303113366),
Offset(12.500129012716759, 26.300644969533792),
Offset(12.5, 26.3),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(31.500705947534364, 37.904137673197035),
Offset(31.224359596665288, 38.04026654278025),
Offset(29.77500721437707, 38.610257636892996),
Offset(27.671279110116373, 39.06613773120253),
Offset(25.221379281133324, 39.03073015693383),
Offset(22.702260300479338, 38.4714008591571),
Offset(20.28270034295162, 37.48547892474107),
Offset(18.054569997652198, 36.18517574943152),
Offset(16.048128541632522, 34.59627819756455),
Offset(14.343114833822348, 32.739119933221964),
Offset(12.99519031795477, 30.657890586626984),
Offset(12.038214592605321, 28.40198375080891),
Offset(11.498734264325233, 26.032323169068647),
Offset(11.392995785033866, 23.617840044802506),
Offset(11.712187869419232, 21.29019602644484),
Offset(12.42139313017819, 19.101094337832414),
Offset(13.45637301051034, 17.152279319649516),
Offset(14.726397156564566, 15.511205096609956),
Offset(16.093303132855745, 14.22536480165701),
Offset(17.347278595340214, 13.332261414827599),
Offset(18.038917684662923, 12.930905807638549),
Offset(18.039538499999995, 12.930571500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(31.500705947534364, 37.904137673197035),
Offset(31.224359596665288, 38.04026654278025),
Offset(29.77500721437707, 38.610257636892996),
Offset(27.671279110116373, 39.06613773120253),
Offset(25.221379281133324, 39.03073015693383),
Offset(22.702260300479338, 38.4714008591571),
Offset(20.28270034295162, 37.48547892474107),
Offset(18.054569997652198, 36.18517574943152),
Offset(16.048128541632522, 34.59627819756455),
Offset(14.343114833822348, 32.739119933221964),
Offset(12.99519031795477, 30.657890586626984),
Offset(12.038214592605321, 28.40198375080891),
Offset(11.498734264325233, 26.032323169068647),
Offset(11.392995785033866, 23.617840044802506),
Offset(11.712187869419232, 21.29019602644484),
Offset(12.42139313017819, 19.101094337832414),
Offset(13.45637301051034, 17.152279319649516),
Offset(14.726397156564566, 15.511205096609956),
Offset(16.093303132855745, 14.22536480165701),
Offset(17.347278595340214, 13.332261414827599),
Offset(18.038917684662923, 12.930905807638549),
Offset(18.039538499999995, 12.930571500000006),
],
<Offset>[
Offset(42.20064775415372, 37.89587099404257),
Offset(41.91674410275704, 38.2405046640102),
Offset(40.34190628686553, 39.857813126404416),
Offset(37.83452426041213, 41.714593496656875),
Offset(34.57684474021924, 43.1287659571083),
Offset(30.91528934967189, 43.89206242373822),
Offset(27.130871371497264, 44.03241690707209),
Offset(23.411876177751978, 43.64328677129125),
Offset(19.813656815016323, 42.74069454351543),
Offset(16.453681942475647, 41.30395235032578),
Offset(13.431837558864594, 39.35824654869015),
Offset(10.822310505850872, 36.948639555937035),
Offset(8.696502202314639, 34.13978724004353),
Offset(7.116981614284766, 31.013066425911557),
Offset(6.150621971699855, 27.74766987427346),
Offset(5.782126079860243, 24.43272505675491),
Offset(5.987301553125755, 21.240953911434477),
Offset(6.686509374540779, 18.31557540123979),
Offset(7.725544616870944, 15.801723190853087),
Offset(8.849588162319126, 13.874059954477616),
Offset(9.523972698054738, 12.931383365108815),
Offset(9.524593499999996, 12.930571500000006),
],
<Offset>[
Offset(42.20064775415372, 37.89587099404257),
Offset(41.91674410275704, 38.2405046640102),
Offset(40.34190628686553, 39.857813126404416),
Offset(37.83452426041213, 41.714593496656875),
Offset(34.57684474021924, 43.1287659571083),
Offset(30.91528934967189, 43.89206242373822),
Offset(27.130871371497264, 44.03241690707209),
Offset(23.411876177751978, 43.64328677129125),
Offset(19.813656815016323, 42.74069454351543),
Offset(16.453681942475647, 41.30395235032578),
Offset(13.431837558864594, 39.35824654869015),
Offset(10.822310505850872, 36.948639555937035),
Offset(8.696502202314639, 34.13978724004353),
Offset(7.116981614284766, 31.013066425911557),
Offset(6.150621971699855, 27.74766987427346),
Offset(5.782126079860243, 24.43272505675491),
Offset(5.987301553125755, 21.240953911434477),
Offset(6.686509374540779, 18.31557540123979),
Offset(7.725544616870944, 15.801723190853087),
Offset(8.849588162319126, 13.874059954477616),
Offset(9.523972698054738, 12.931383365108815),
Offset(9.524593499999996, 12.930571500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(42.20064775415372, 37.89587099404257),
Offset(41.91674410275704, 38.2405046640102),
Offset(40.34190628686553, 39.857813126404416),
Offset(37.83452426041213, 41.714593496656875),
Offset(34.57684474021924, 43.1287659571083),
Offset(30.91528934967189, 43.89206242373822),
Offset(27.130871371497264, 44.03241690707209),
Offset(23.411876177751978, 43.64328677129125),
Offset(19.813656815016323, 42.74069454351543),
Offset(16.453681942475647, 41.30395235032578),
Offset(13.431837558864594, 39.35824654869015),
Offset(10.822310505850872, 36.948639555937035),
Offset(8.696502202314639, 34.13978724004353),
Offset(7.116981614284766, 31.013066425911557),
Offset(6.150621971699855, 27.74766987427346),
Offset(5.782126079860243, 24.43272505675491),
Offset(5.987301553125755, 21.240953911434477),
Offset(6.686509374540779, 18.31557540123979),
Offset(7.725544616870944, 15.801723190853087),
Offset(8.849588162319126, 13.874059954477616),
Offset(9.523972698054738, 12.931383365108815),
Offset(9.524593499999996, 12.930571500000006),
],
<Offset>[
Offset(42.19072773916836, 25.055940826099334),
Offset(42.15702984823299, 25.409643256700093),
Offset(41.838972874279236, 27.177534239418264),
Offset(41.01267117895735, 29.518699316301966),
Offset(39.49448770042861, 31.902207406205207),
Offset(37.42008322716923, 34.036427564707154),
Offset(34.987196950294496, 35.814611672817314),
Offset(32.36160940398365, 37.21451935517152),
Offset(29.58695643015737, 38.22206061545487),
Offset(26.731480843000227, 38.77127181994182),
Offset(23.87226471334039, 38.83426985959836),
Offset(21.07829747200463, 38.407724460042374),
Offset(18.4254590874845, 37.50246571445624),
Offset(15.991253271615628, 36.144283430810475),
Offset(13.899590589094196, 34.421548951536714),
Offset(12.180082942567237, 32.39984551713645),
Offset(10.893711063267709, 30.203839660295976),
Offset(10.05175374009658, 27.963440739668336),
Offset(9.617174683906235, 25.84303341003485),
Offset(9.499746409899146, 24.07128847410292),
Offset(9.52454576701906, 23.149317349038636),
Offset(9.524593499999998, 23.148505500000006),
],
<Offset>[
Offset(42.19072773916836, 25.055940826099334),
Offset(42.15702984823299, 25.409643256700093),
Offset(41.838972874279236, 27.177534239418264),
Offset(41.01267117895735, 29.518699316301966),
Offset(39.49448770042861, 31.902207406205207),
Offset(37.42008322716923, 34.036427564707154),
Offset(34.987196950294496, 35.814611672817314),
Offset(32.36160940398365, 37.21451935517152),
Offset(29.58695643015737, 38.22206061545487),
Offset(26.731480843000227, 38.77127181994182),
Offset(23.87226471334039, 38.83426985959836),
Offset(21.07829747200463, 38.407724460042374),
Offset(18.4254590874845, 37.50246571445624),
Offset(15.991253271615628, 36.144283430810475),
Offset(13.899590589094196, 34.421548951536714),
Offset(12.180082942567237, 32.39984551713645),
Offset(10.893711063267709, 30.203839660295976),
Offset(10.05175374009658, 27.963440739668336),
Offset(9.617174683906235, 25.84303341003485),
Offset(9.499746409899146, 24.07128847410292),
Offset(9.52454576701906, 23.149317349038636),
Offset(9.524593499999998, 23.148505500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(42.19072773916836, 25.055940826099334),
Offset(42.15702984823299, 25.409643256700093),
Offset(41.838972874279236, 27.177534239418264),
Offset(41.01267117895735, 29.518699316301966),
Offset(39.49448770042861, 31.902207406205207),
Offset(37.42008322716923, 34.036427564707154),
Offset(34.987196950294496, 35.814611672817314),
Offset(32.36160940398365, 37.21451935517152),
Offset(29.58695643015737, 38.22206061545487),
Offset(26.731480843000227, 38.77127181994182),
Offset(23.87226471334039, 38.83426985959836),
Offset(21.07829747200463, 38.407724460042374),
Offset(18.4254590874845, 37.50246571445624),
Offset(15.991253271615628, 36.144283430810475),
Offset(13.899590589094196, 34.421548951536714),
Offset(12.180082942567237, 32.39984551713645),
Offset(10.893711063267709, 30.203839660295976),
Offset(10.05175374009658, 27.963440739668336),
Offset(9.617174683906235, 25.84303341003485),
Offset(9.499746409899146, 24.07128847410292),
Offset(9.52454576701906, 23.149317349038636),
Offset(9.524593499999998, 23.148505500000006),
],
<Offset>[
Offset(31.490785932549, 25.064207505253805),
Offset(31.46464534214123, 25.209405135470142),
Offset(31.272073801790775, 25.92997874990684),
Offset(30.84942602866159, 26.87024355084762),
Offset(30.139022241342694, 27.80417160603073),
Offset(29.207054177976676, 28.615766000126037),
Offset(28.139025921748853, 29.26767369048629),
Offset(27.004303223883873, 29.75640833331179),
Offset(25.82142815677357, 30.077644269503992),
Offset(24.620913734346928, 30.206439402838008),
Offset(23.435617472430565, 30.133913897535194),
Offset(22.294201558759077, 29.861068654914245),
Offset(21.227691149495094, 29.395001643481358),
Offset(20.267267442364727, 28.749057049701424),
Offset(19.46115648681357, 27.964075103708094),
Offset(18.819349992885186, 27.06821479821395),
Offset(18.362782520652296, 26.115165068511015),
Offset(18.091641522120366, 25.1590704350385),
Offset(17.984933199891035, 24.26667502083877),
Offset(17.997436842920234, 23.529489934452904),
Offset(18.039490753627245, 23.14883979156837),
Offset(18.0395385, 23.148505500000006),
],
<Offset>[
Offset(31.490785932549, 25.064207505253805),
Offset(31.46464534214123, 25.209405135470142),
Offset(31.272073801790775, 25.92997874990684),
Offset(30.84942602866159, 26.87024355084762),
Offset(30.139022241342694, 27.80417160603073),
Offset(29.207054177976676, 28.615766000126037),
Offset(28.139025921748853, 29.26767369048629),
Offset(27.004303223883873, 29.75640833331179),
Offset(25.82142815677357, 30.077644269503992),
Offset(24.620913734346928, 30.206439402838008),
Offset(23.435617472430565, 30.133913897535194),
Offset(22.294201558759077, 29.861068654914245),
Offset(21.227691149495094, 29.395001643481358),
Offset(20.267267442364727, 28.749057049701424),
Offset(19.46115648681357, 27.964075103708094),
Offset(18.819349992885186, 27.06821479821395),
Offset(18.362782520652296, 26.115165068511015),
Offset(18.091641522120366, 25.1590704350385),
Offset(17.984933199891035, 24.26667502083877),
Offset(17.997436842920234, 23.529489934452904),
Offset(18.039490753627245, 23.14883979156837),
Offset(18.0395385, 23.148505500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(31.490785932549, 25.064207505253805),
Offset(31.46464534214123, 25.209405135470142),
Offset(31.272073801790775, 25.92997874990684),
Offset(30.84942602866159, 26.87024355084762),
Offset(30.139022241342694, 27.80417160603073),
Offset(29.207054177976676, 28.615766000126037),
Offset(28.139025921748853, 29.26767369048629),
Offset(27.004303223883873, 29.75640833331179),
Offset(25.82142815677357, 30.077644269503992),
Offset(24.620913734346928, 30.206439402838008),
Offset(23.435617472430565, 30.133913897535194),
Offset(22.294201558759077, 29.861068654914245),
Offset(21.227691149495094, 29.395001643481358),
Offset(20.267267442364727, 28.749057049701424),
Offset(19.46115648681357, 27.964075103708094),
Offset(18.819349992885186, 27.06821479821395),
Offset(18.362782520652296, 26.115165068511015),
Offset(18.091641522120366, 25.1590704350385),
Offset(17.984933199891035, 24.26667502083877),
Offset(17.997436842920234, 23.529489934452904),
Offset(18.039490753627245, 23.14883979156837),
Offset(18.0395385, 23.148505500000006),
],
<Offset>[
Offset(31.500705947534364, 37.904137673197035),
Offset(31.224359596665288, 38.04026654278025),
Offset(29.77500721437707, 38.610257636892996),
Offset(27.671279110116373, 39.06613773120253),
Offset(25.221379281133324, 39.03073015693383),
Offset(22.702260300479338, 38.4714008591571),
Offset(20.28270034295162, 37.48547892474107),
Offset(18.054569997652198, 36.18517574943152),
Offset(16.048128541632522, 34.59627819756455),
Offset(14.343114833822348, 32.739119933221964),
Offset(12.99519031795477, 30.657890586626984),
Offset(12.038214592605321, 28.40198375080891),
Offset(11.498734264325233, 26.032323169068647),
Offset(11.392995785033866, 23.617840044802506),
Offset(11.712187869419232, 21.29019602644484),
Offset(12.42139313017819, 19.101094337832414),
Offset(13.45637301051034, 17.152279319649516),
Offset(14.726397156564566, 15.511205096609956),
Offset(16.093303132855745, 14.22536480165701),
Offset(17.347278595340214, 13.332261414827599),
Offset(18.038917684662923, 12.930905807638549),
Offset(18.039538499999995, 12.930571500000006),
],
<Offset>[
Offset(31.500705947534364, 37.904137673197035),
Offset(31.224359596665288, 38.04026654278025),
Offset(29.77500721437707, 38.610257636892996),
Offset(27.671279110116373, 39.06613773120253),
Offset(25.221379281133324, 39.03073015693383),
Offset(22.702260300479338, 38.4714008591571),
Offset(20.28270034295162, 37.48547892474107),
Offset(18.054569997652198, 36.18517574943152),
Offset(16.048128541632522, 34.59627819756455),
Offset(14.343114833822348, 32.739119933221964),
Offset(12.99519031795477, 30.657890586626984),
Offset(12.038214592605321, 28.40198375080891),
Offset(11.498734264325233, 26.032323169068647),
Offset(11.392995785033866, 23.617840044802506),
Offset(11.712187869419232, 21.29019602644484),
Offset(12.42139313017819, 19.101094337832414),
Offset(13.45637301051034, 17.152279319649516),
Offset(14.726397156564566, 15.511205096609956),
Offset(16.093303132855745, 14.22536480165701),
Offset(17.347278595340214, 13.332261414827599),
Offset(18.038917684662923, 12.930905807638549),
Offset(18.039538499999995, 12.930571500000006),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(5.809272260831642, 22.944059173900662),
Offset(5.842970151767011, 22.590356743299907),
Offset(6.161027125720756, 20.822465760581736),
Offset(6.987328821042649, 18.48130068369803),
Offset(8.505512299571395, 16.097792593794804),
Offset(10.579916772830773, 13.963572435292853),
Offset(13.012803049705509, 12.18538832718269),
Offset(15.638390596016343, 10.785480644828485),
Offset(18.413043569842625, 9.77793938454513),
Offset(21.26851915699977, 9.228728180058184),
Offset(24.12773528665962, 9.165730140401642),
Offset(26.92170252799538, 9.592275539957622),
Offset(29.5745409125155, 10.497534285543754),
Offset(32.008746728384374, 11.855716569189521),
Offset(34.100409410905804, 13.578451048463291),
Offset(35.819917057432754, 15.600154482863552),
Offset(37.10628893673229, 17.796160339704027),
Offset(37.94824625990342, 20.03655926033166),
Offset(38.38282531609377, 22.156966589965144),
Offset(38.50025359010085, 23.928711525897086),
Offset(38.47545423298094, 24.850682650961364),
Offset(38.4754065, 24.8514945),
],
),
_PathCubicTo(
<Offset>[
Offset(5.809272260831642, 22.944059173900662),
Offset(5.842970151767011, 22.590356743299907),
Offset(6.161027125720756, 20.822465760581736),
Offset(6.987328821042649, 18.48130068369803),
Offset(8.505512299571395, 16.097792593794804),
Offset(10.579916772830773, 13.963572435292853),
Offset(13.012803049705509, 12.18538832718269),
Offset(15.638390596016343, 10.785480644828485),
Offset(18.413043569842625, 9.77793938454513),
Offset(21.26851915699977, 9.228728180058184),
Offset(24.12773528665962, 9.165730140401642),
Offset(26.92170252799538, 9.592275539957622),
Offset(29.5745409125155, 10.497534285543754),
Offset(32.008746728384374, 11.855716569189521),
Offset(34.100409410905804, 13.578451048463291),
Offset(35.819917057432754, 15.600154482863552),
Offset(37.10628893673229, 17.796160339704027),
Offset(37.94824625990342, 20.03655926033166),
Offset(38.38282531609377, 22.156966589965144),
Offset(38.50025359010085, 23.928711525897086),
Offset(38.47545423298094, 24.850682650961364),
Offset(38.4754065, 24.8514945),
],
<Offset>[
Offset(16.509214067451, 22.93579249474619),
Offset(16.53535465785877, 22.790594864529858),
Offset(16.727926198209218, 22.07002125009316),
Offset(17.150573971338403, 21.129756449152378),
Offset(17.86097775865731, 20.19582839396928),
Offset(18.792945822023324, 19.38423399987397),
Offset(19.860974078251154, 18.732326309513716),
Offset(20.995696776116127, 18.24359166668821),
Offset(22.178571843226425, 17.922355730496008),
Offset(23.379086265653072, 17.793560597162),
Offset(24.564382527569446, 17.866086102464806),
Offset(25.70579844124093, 18.13893134508575),
Offset(26.772308850504906, 18.60499835651864),
Offset(27.732732557635273, 19.250942950298572),
Offset(28.53884351318643, 20.03592489629191),
Offset(29.180650007114806, 20.93178520178605),
Offset(29.637217479347704, 21.88483493148899),
Offset(29.908358477879634, 22.840929564961495),
Offset(30.015066800108972, 23.733324979161225),
Offset(30.00256315707976, 24.470510065547103),
Offset(29.960509246372755, 24.85116020843163),
Offset(29.9604615, 24.8514945),
],
<Offset>[
Offset(16.509214067451, 22.93579249474619),
Offset(16.53535465785877, 22.790594864529858),
Offset(16.727926198209218, 22.07002125009316),
Offset(17.150573971338403, 21.129756449152378),
Offset(17.86097775865731, 20.19582839396928),
Offset(18.792945822023324, 19.38423399987397),
Offset(19.860974078251154, 18.732326309513716),
Offset(20.995696776116127, 18.24359166668821),
Offset(22.178571843226425, 17.922355730496008),
Offset(23.379086265653072, 17.793560597162),
Offset(24.564382527569446, 17.866086102464806),
Offset(25.70579844124093, 18.13893134508575),
Offset(26.772308850504906, 18.60499835651864),
Offset(27.732732557635273, 19.250942950298572),
Offset(28.53884351318643, 20.03592489629191),
Offset(29.180650007114806, 20.93178520178605),
Offset(29.637217479347704, 21.88483493148899),
Offset(29.908358477879634, 22.840929564961495),
Offset(30.015066800108972, 23.733324979161225),
Offset(30.00256315707976, 24.470510065547103),
Offset(29.960509246372755, 24.85116020843163),
Offset(29.9604615, 24.8514945),
],
),
_PathCubicTo(
<Offset>[
Offset(16.509214067451, 22.93579249474619),
Offset(16.53535465785877, 22.790594864529858),
Offset(16.727926198209218, 22.07002125009316),
Offset(17.150573971338403, 21.129756449152378),
Offset(17.86097775865731, 20.19582839396928),
Offset(18.792945822023324, 19.38423399987397),
Offset(19.860974078251154, 18.732326309513716),
Offset(20.995696776116127, 18.24359166668821),
Offset(22.178571843226425, 17.922355730496008),
Offset(23.379086265653072, 17.793560597162),
Offset(24.564382527569446, 17.866086102464806),
Offset(25.70579844124093, 18.13893134508575),
Offset(26.772308850504906, 18.60499835651864),
Offset(27.732732557635273, 19.250942950298572),
Offset(28.53884351318643, 20.03592489629191),
Offset(29.180650007114806, 20.93178520178605),
Offset(29.637217479347704, 21.88483493148899),
Offset(29.908358477879634, 22.840929564961495),
Offset(30.015066800108972, 23.733324979161225),
Offset(30.00256315707976, 24.470510065547103),
Offset(29.960509246372755, 24.85116020843163),
Offset(29.9604615, 24.8514945),
],
<Offset>[
Offset(16.49929405246564, 10.095862326802958),
Offset(16.775640403334712, 9.95973345721975),
Offset(18.224992785622923, 9.389742363107004),
Offset(20.328720889883623, 8.93386226879747),
Offset(22.778620718866684, 8.969269843066183),
Offset(25.297739699520662, 9.528599140842907),
Offset(27.717299657048386, 10.514521075258944),
Offset(29.9454300023478, 11.814824250568474),
Offset(31.951871458367474, 13.403721802435447),
Offset(33.656885166177645, 15.26088006677804),
Offset(35.00480968204524, 17.342109413373016),
Offset(35.961785407394686, 19.59801624919109),
Offset(36.501265735674764, 21.96767683093135),
Offset(36.60700421496613, 24.38215995519749),
Offset(36.28781213058077, 26.70980397355516),
Offset(35.578606869821805, 28.898905662167586),
Offset(34.54362698948966, 30.847720680350488),
Offset(33.273602843435434, 32.48879490339004),
Offset(31.906696867144262, 33.774635198342985),
Offset(30.65272140465978, 34.66773858517241),
Offset(29.961082315337077, 35.069094192361455),
Offset(29.9604615, 35.0694285),
],
<Offset>[
Offset(16.49929405246564, 10.095862326802958),
Offset(16.775640403334712, 9.95973345721975),
Offset(18.224992785622923, 9.389742363107004),
Offset(20.328720889883623, 8.93386226879747),
Offset(22.778620718866684, 8.969269843066183),
Offset(25.297739699520662, 9.528599140842907),
Offset(27.717299657048386, 10.514521075258944),
Offset(29.9454300023478, 11.814824250568474),
Offset(31.951871458367474, 13.403721802435447),
Offset(33.656885166177645, 15.26088006677804),
Offset(35.00480968204524, 17.342109413373016),
Offset(35.961785407394686, 19.59801624919109),
Offset(36.501265735674764, 21.96767683093135),
Offset(36.60700421496613, 24.38215995519749),
Offset(36.28781213058077, 26.70980397355516),
Offset(35.578606869821805, 28.898905662167586),
Offset(34.54362698948966, 30.847720680350488),
Offset(33.273602843435434, 32.48879490339004),
Offset(31.906696867144262, 33.774635198342985),
Offset(30.65272140465978, 34.66773858517241),
Offset(29.961082315337077, 35.069094192361455),
Offset(29.9604615, 35.0694285),
],
),
_PathCubicTo(
<Offset>[
Offset(16.49929405246564, 10.095862326802958),
Offset(16.775640403334712, 9.95973345721975),
Offset(18.224992785622923, 9.389742363107004),
Offset(20.328720889883623, 8.93386226879747),
Offset(22.778620718866684, 8.969269843066183),
Offset(25.297739699520662, 9.528599140842907),
Offset(27.717299657048386, 10.514521075258944),
Offset(29.9454300023478, 11.814824250568474),
Offset(31.951871458367474, 13.403721802435447),
Offset(33.656885166177645, 15.26088006677804),
Offset(35.00480968204524, 17.342109413373016),
Offset(35.961785407394686, 19.59801624919109),
Offset(36.501265735674764, 21.96767683093135),
Offset(36.60700421496613, 24.38215995519749),
Offset(36.28781213058077, 26.70980397355516),
Offset(35.578606869821805, 28.898905662167586),
Offset(34.54362698948966, 30.847720680350488),
Offset(33.273602843435434, 32.48879490339004),
Offset(31.906696867144262, 33.774635198342985),
Offset(30.65272140465978, 34.66773858517241),
Offset(29.961082315337077, 35.069094192361455),
Offset(29.9604615, 35.0694285),
],
<Offset>[
Offset(5.799352245846278, 10.104129005957429),
Offset(6.083255897242955, 9.759495335989797),
Offset(7.658093713134462, 8.14218687359558),
Offset(10.165475739587867, 6.285406503343122),
Offset(13.423155259780767, 4.871234042891707),
Offset(17.08471065032811, 4.107937576261792),
Offset(20.869128628502743, 3.9675830929279154),
Offset(24.588123822248015, 4.356713228708747),
Offset(28.186343184983674, 5.2593054564845705),
Offset(31.546318057524346, 6.696047649674224),
Offset(34.56816244113542, 8.641753451309853),
Offset(37.177689494149135, 11.051360444062961),
Offset(39.30349779768536, 13.860212759956465),
Offset(40.88301838571523, 16.98693357408844),
Offset(41.849378028300144, 20.252330125726544),
Offset(42.21787392013975, 23.56727494324509),
Offset(42.012698446874246, 26.759046088565526),
Offset(41.313490625459224, 29.684424598760206),
Offset(40.274455383129066, 32.198276809146904),
Offset(39.15041183768086, 34.12594004552239),
Offset(38.476027301945265, 35.068616634891185),
Offset(38.4754065, 35.0694285),
],
<Offset>[
Offset(5.799352245846278, 10.104129005957429),
Offset(6.083255897242955, 9.759495335989797),
Offset(7.658093713134462, 8.14218687359558),
Offset(10.165475739587867, 6.285406503343122),
Offset(13.423155259780767, 4.871234042891707),
Offset(17.08471065032811, 4.107937576261792),
Offset(20.869128628502743, 3.9675830929279154),
Offset(24.588123822248015, 4.356713228708747),
Offset(28.186343184983674, 5.2593054564845705),
Offset(31.546318057524346, 6.696047649674224),
Offset(34.56816244113542, 8.641753451309853),
Offset(37.177689494149135, 11.051360444062961),
Offset(39.30349779768536, 13.860212759956465),
Offset(40.88301838571523, 16.98693357408844),
Offset(41.849378028300144, 20.252330125726544),
Offset(42.21787392013975, 23.56727494324509),
Offset(42.012698446874246, 26.759046088565526),
Offset(41.313490625459224, 29.684424598760206),
Offset(40.274455383129066, 32.198276809146904),
Offset(39.15041183768086, 34.12594004552239),
Offset(38.476027301945265, 35.068616634891185),
Offset(38.4754065, 35.0694285),
],
),
_PathCubicTo(
<Offset>[
Offset(5.799352245846278, 10.104129005957429),
Offset(6.083255897242955, 9.759495335989797),
Offset(7.658093713134462, 8.14218687359558),
Offset(10.165475739587867, 6.285406503343122),
Offset(13.423155259780767, 4.871234042891707),
Offset(17.08471065032811, 4.107937576261792),
Offset(20.869128628502743, 3.9675830929279154),
Offset(24.588123822248015, 4.356713228708747),
Offset(28.186343184983674, 5.2593054564845705),
Offset(31.546318057524346, 6.696047649674224),
Offset(34.56816244113542, 8.641753451309853),
Offset(37.177689494149135, 11.051360444062961),
Offset(39.30349779768536, 13.860212759956465),
Offset(40.88301838571523, 16.98693357408844),
Offset(41.849378028300144, 20.252330125726544),
Offset(42.21787392013975, 23.56727494324509),
Offset(42.012698446874246, 26.759046088565526),
Offset(41.313490625459224, 29.684424598760206),
Offset(40.274455383129066, 32.198276809146904),
Offset(39.15041183768086, 34.12594004552239),
Offset(38.476027301945265, 35.068616634891185),
Offset(38.4754065, 35.0694285),
],
<Offset>[
Offset(5.809272260831642, 22.944059173900662),
Offset(5.842970151767011, 22.590356743299907),
Offset(6.161027125720756, 20.822465760581736),
Offset(6.987328821042649, 18.48130068369803),
Offset(8.505512299571395, 16.097792593794804),
Offset(10.579916772830773, 13.963572435292853),
Offset(13.012803049705509, 12.18538832718269),
Offset(15.638390596016343, 10.785480644828485),
Offset(18.413043569842625, 9.77793938454513),
Offset(21.26851915699977, 9.228728180058184),
Offset(24.12773528665962, 9.165730140401642),
Offset(26.92170252799538, 9.592275539957622),
Offset(29.5745409125155, 10.497534285543754),
Offset(32.008746728384374, 11.855716569189521),
Offset(34.100409410905804, 13.578451048463291),
Offset(35.819917057432754, 15.600154482863552),
Offset(37.10628893673229, 17.796160339704027),
Offset(37.94824625990342, 20.03655926033166),
Offset(38.38282531609377, 22.156966589965144),
Offset(38.50025359010085, 23.928711525897086),
Offset(38.47545423298094, 24.850682650961364),
Offset(38.4754065, 24.8514945),
],
<Offset>[
Offset(5.809272260831642, 22.944059173900662),
Offset(5.842970151767011, 22.590356743299907),
Offset(6.161027125720756, 20.822465760581736),
Offset(6.987328821042649, 18.48130068369803),
Offset(8.505512299571395, 16.097792593794804),
Offset(10.579916772830773, 13.963572435292853),
Offset(13.012803049705509, 12.18538832718269),
Offset(15.638390596016343, 10.785480644828485),
Offset(18.413043569842625, 9.77793938454513),
Offset(21.26851915699977, 9.228728180058184),
Offset(24.12773528665962, 9.165730140401642),
Offset(26.92170252799538, 9.592275539957622),
Offset(29.5745409125155, 10.497534285543754),
Offset(32.008746728384374, 11.855716569189521),
Offset(34.100409410905804, 13.578451048463291),
Offset(35.819917057432754, 15.600154482863552),
Offset(37.10628893673229, 17.796160339704027),
Offset(37.94824625990342, 20.03655926033166),
Offset(38.38282531609377, 22.156966589965144),
Offset(38.50025359010085, 23.928711525897086),
Offset(38.47545423298094, 24.850682650961364),
Offset(38.4754065, 24.8514945),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(18.649202428774874, 22.9341391589153),
Offset(18.67383155907712, 22.83064248877585),
Offset(18.841306012706912, 22.31953234799544),
Offset(19.183223001397558, 21.65944760224325),
Offset(19.732070850474493, 21.015435554004174),
Offset(20.435551631861834, 20.468366312790188),
Offset(21.23060828396028, 20.041713905979922),
Offset(22.06715801213608, 19.735213871060157),
Offset(22.931677497903188, 19.55123899968618),
Offset(23.801199687383725, 19.506527080582764),
Offset(24.651711975751407, 19.606157294877438),
Offset(25.46261762389004, 19.84826250611138),
Offset(26.211862438102788, 20.22649117071362),
Offset(26.877529723485452, 20.729988226520383),
Offset(27.426530333642553, 21.327419665857633),
Offset(27.852796597051224, 21.998111345570546),
Offset(28.14340318787079, 22.70256984984598),
Offset(28.300380921474876, 23.40180362588746),
Offset(28.341515096912012, 24.048596657000438),
Offset(28.30302507047554, 24.578869773477106),
Offset(28.25752024905112, 24.851255719925685),
Offset(28.2574725, 24.8514945),
],
),
_PathCubicTo(
<Offset>[
Offset(18.649202428774874, 22.9341391589153),
Offset(18.67383155907712, 22.83064248877585),
Offset(18.841306012706912, 22.31953234799544),
Offset(19.183223001397558, 21.65944760224325),
Offset(19.732070850474493, 21.015435554004174),
Offset(20.435551631861834, 20.468366312790188),
Offset(21.23060828396028, 20.041713905979922),
Offset(22.06715801213608, 19.735213871060157),
Offset(22.931677497903188, 19.55123899968618),
Offset(23.801199687383725, 19.506527080582764),
Offset(24.651711975751407, 19.606157294877438),
Offset(25.46261762389004, 19.84826250611138),
Offset(26.211862438102788, 20.22649117071362),
Offset(26.877529723485452, 20.729988226520383),
Offset(27.426530333642553, 21.327419665857633),
Offset(27.852796597051224, 21.998111345570546),
Offset(28.14340318787079, 22.70256984984598),
Offset(28.300380921474876, 23.40180362588746),
Offset(28.341515096912012, 24.048596657000438),
Offset(28.30302507047554, 24.578869773477106),
Offset(28.25752024905112, 24.851255719925685),
Offset(28.2574725, 24.8514945),
],
<Offset>[
Offset(29.349144235394235, 22.92587247976083),
Offset(29.366216065168874, 23.030880610005802),
Offset(29.408205085195373, 23.567087837506865),
Offset(29.346468151693315, 24.307903367697598),
Offset(29.087536309560406, 25.11347135417865),
Offset(28.648580681054387, 25.889027877371305),
Offset(28.078779312505926, 26.58865188831095),
Offset(27.42446419223586, 27.193324892919883),
Offset(26.69720577128699, 27.695655345637057),
Offset(25.91176679603703, 28.07135949768658),
Offset(25.08835921666123, 28.3065132569406),
Offset(24.24671353713559, 28.394918311239508),
Offset(23.409630376092196, 28.333955241688503),
Offset(22.601515552736352, 28.125214607629434),
Offset(21.864964435923177, 27.78489351368625),
Offset(21.213529546733277, 27.329742064493043),
Offset(20.6743317304862, 26.79124444163094),
Offset(20.26049313945109, 26.206173930517295),
Offset(19.973756580927212, 25.62495504619652),
Offset(19.805334637454454, 25.120668313127123),
Offset(19.742575262442934, 24.85173327739595),
Offset(19.7425275, 24.8514945),
],
<Offset>[
Offset(29.349144235394235, 22.92587247976083),
Offset(29.366216065168874, 23.030880610005802),
Offset(29.408205085195373, 23.567087837506865),
Offset(29.346468151693315, 24.307903367697598),
Offset(29.087536309560406, 25.11347135417865),
Offset(28.648580681054387, 25.889027877371305),
Offset(28.078779312505926, 26.58865188831095),
Offset(27.42446419223586, 27.193324892919883),
Offset(26.69720577128699, 27.695655345637057),
Offset(25.91176679603703, 28.07135949768658),
Offset(25.08835921666123, 28.3065132569406),
Offset(24.24671353713559, 28.394918311239508),
Offset(23.409630376092196, 28.333955241688503),
Offset(22.601515552736352, 28.125214607629434),
Offset(21.864964435923177, 27.78489351368625),
Offset(21.213529546733277, 27.329742064493043),
Offset(20.6743317304862, 26.79124444163094),
Offset(20.26049313945109, 26.206173930517295),
Offset(19.973756580927212, 25.62495504619652),
Offset(19.805334637454454, 25.120668313127123),
Offset(19.742575262442934, 24.85173327739595),
Offset(19.7425275, 24.8514945),
],
),
_PathCubicTo(
<Offset>[
Offset(29.349144235394235, 22.92587247976083),
Offset(29.366216065168874, 23.030880610005802),
Offset(29.408205085195373, 23.567087837506865),
Offset(29.346468151693315, 24.307903367697598),
Offset(29.087536309560406, 25.11347135417865),
Offset(28.648580681054387, 25.889027877371305),
Offset(28.078779312505926, 26.58865188831095),
Offset(27.42446419223586, 27.193324892919883),
Offset(26.69720577128699, 27.695655345637057),
Offset(25.91176679603703, 28.07135949768658),
Offset(25.08835921666123, 28.3065132569406),
Offset(24.24671353713559, 28.394918311239508),
Offset(23.409630376092196, 28.333955241688503),
Offset(22.601515552736352, 28.125214607629434),
Offset(21.864964435923177, 27.78489351368625),
Offset(21.213529546733277, 27.329742064493043),
Offset(20.6743317304862, 26.79124444163094),
Offset(20.26049313945109, 26.206173930517295),
Offset(19.973756580927212, 25.62495504619652),
Offset(19.805334637454454, 25.120668313127123),
Offset(19.742575262442934, 24.85173327739595),
Offset(19.7425275, 24.8514945),
],
<Offset>[
Offset(29.33922422040887, 10.085942311817597),
Offset(29.60650181064482, 10.200019202695694),
Offset(30.90527167260908, 10.88680895052071),
Offset(32.52461507023853, 12.11200918734269),
Offset(34.005179269769776, 13.886912803275553),
Offset(35.153374558551725, 16.03339301834024),
Offset(35.93510489130316, 18.370846654056177),
Offset(36.37419741846753, 20.764557476800146),
Offset(36.47050538642804, 23.177021417576494),
Offset(36.1895656965616, 25.538678967302616),
Offset(35.52878637113702, 27.782536567848812),
Offset(34.50270050328935, 29.854003215344843),
Offset(33.13858726126206, 31.696633716101214),
Offset(31.475787210067217, 33.25643161252835),
Offset(29.613933053317517, 34.4587725909495),
Offset(27.611486409440268, 35.29686252487458),
Offset(25.580741240628157, 35.75413019049244),
Offset(23.62573750500689, 35.85403926894584),
Offset(21.865386647962502, 35.66626526537828),
Offset(20.455492885034474, 35.317896832752425),
Offset(19.743148331407255, 35.069667261325776),
Offset(19.7425275, 35.0694285),
],
<Offset>[
Offset(29.33922422040887, 10.085942311817597),
Offset(29.60650181064482, 10.200019202695694),
Offset(30.90527167260908, 10.88680895052071),
Offset(32.52461507023853, 12.11200918734269),
Offset(34.005179269769776, 13.886912803275553),
Offset(35.153374558551725, 16.03339301834024),
Offset(35.93510489130316, 18.370846654056177),
Offset(36.37419741846753, 20.764557476800146),
Offset(36.47050538642804, 23.177021417576494),
Offset(36.1895656965616, 25.538678967302616),
Offset(35.52878637113702, 27.782536567848812),
Offset(34.50270050328935, 29.854003215344843),
Offset(33.13858726126206, 31.696633716101214),
Offset(31.475787210067217, 33.25643161252835),
Offset(29.613933053317517, 34.4587725909495),
Offset(27.611486409440268, 35.29686252487458),
Offset(25.580741240628157, 35.75413019049244),
Offset(23.62573750500689, 35.85403926894584),
Offset(21.865386647962502, 35.66626526537828),
Offset(20.455492885034474, 35.317896832752425),
Offset(19.743148331407255, 35.069667261325776),
Offset(19.7425275, 35.0694285),
],
),
_PathCubicTo(
<Offset>[
Offset(29.33922422040887, 10.085942311817597),
Offset(29.60650181064482, 10.200019202695694),
Offset(30.90527167260908, 10.88680895052071),
Offset(32.52461507023853, 12.11200918734269),
Offset(34.005179269769776, 13.886912803275553),
Offset(35.153374558551725, 16.03339301834024),
Offset(35.93510489130316, 18.370846654056177),
Offset(36.37419741846753, 20.764557476800146),
Offset(36.47050538642804, 23.177021417576494),
Offset(36.1895656965616, 25.538678967302616),
Offset(35.52878637113702, 27.782536567848812),
Offset(34.50270050328935, 29.854003215344843),
Offset(33.13858726126206, 31.696633716101214),
Offset(31.475787210067217, 33.25643161252835),
Offset(29.613933053317517, 34.4587725909495),
Offset(27.611486409440268, 35.29686252487458),
Offset(25.580741240628157, 35.75413019049244),
Offset(23.62573750500689, 35.85403926894584),
Offset(21.865386647962502, 35.66626526537828),
Offset(20.455492885034474, 35.317896832752425),
Offset(19.743148331407255, 35.069667261325776),
Offset(19.7425275, 35.0694285),
],
<Offset>[
Offset(18.63928241378951, 10.094208990972067),
Offset(18.914117304553063, 9.999781081465741),
Offset(20.338372600120618, 9.639253461009286),
Offset(22.361369919942774, 9.463553421888342),
Offset(24.649713810683863, 9.788877003101078),
Offset(26.940345509359172, 10.612731453759126),
Offset(29.086933862757515, 11.823908671725148),
Offset(31.016891238367755, 13.306446454940419),
Offset(32.70497711304424, 15.03260507162562),
Offset(34.0789985879083, 16.9738465501988),
Offset(35.0921391302272, 19.08218060578565),
Offset(35.718604590043796, 21.307347410216714),
Offset(35.94081932327265, 23.58916964512633),
Offset(35.75180138081632, 25.8612052314193),
Offset(35.17549895103689, 28.001298743120884),
Offset(34.250753459758215, 29.965231805952083),
Offset(33.049812698012744, 31.665455598707478),
Offset(31.665625287030675, 33.049668964316005),
Offset(30.233145163947302, 34.0899068761822),
Offset(28.95318331805556, 34.776098293102415),
Offset(28.25809331801544, 35.06918970385551),
Offset(28.2574725, 35.0694285),
],
<Offset>[
Offset(18.63928241378951, 10.094208990972067),
Offset(18.914117304553063, 9.999781081465741),
Offset(20.338372600120618, 9.639253461009286),
Offset(22.361369919942774, 9.463553421888342),
Offset(24.649713810683863, 9.788877003101078),
Offset(26.940345509359172, 10.612731453759126),
Offset(29.086933862757515, 11.823908671725148),
Offset(31.016891238367755, 13.306446454940419),
Offset(32.70497711304424, 15.03260507162562),
Offset(34.0789985879083, 16.9738465501988),
Offset(35.0921391302272, 19.08218060578565),
Offset(35.718604590043796, 21.307347410216714),
Offset(35.94081932327265, 23.58916964512633),
Offset(35.75180138081632, 25.8612052314193),
Offset(35.17549895103689, 28.001298743120884),
Offset(34.250753459758215, 29.965231805952083),
Offset(33.049812698012744, 31.665455598707478),
Offset(31.665625287030675, 33.049668964316005),
Offset(30.233145163947302, 34.0899068761822),
Offset(28.95318331805556, 34.776098293102415),
Offset(28.25809331801544, 35.06918970385551),
Offset(28.2574725, 35.0694285),
],
),
_PathCubicTo(
<Offset>[
Offset(18.63928241378951, 10.094208990972067),
Offset(18.914117304553063, 9.999781081465741),
Offset(20.338372600120618, 9.639253461009286),
Offset(22.361369919942774, 9.463553421888342),
Offset(24.649713810683863, 9.788877003101078),
Offset(26.940345509359172, 10.612731453759126),
Offset(29.086933862757515, 11.823908671725148),
Offset(31.016891238367755, 13.306446454940419),
Offset(32.70497711304424, 15.03260507162562),
Offset(34.0789985879083, 16.9738465501988),
Offset(35.0921391302272, 19.08218060578565),
Offset(35.718604590043796, 21.307347410216714),
Offset(35.94081932327265, 23.58916964512633),
Offset(35.75180138081632, 25.8612052314193),
Offset(35.17549895103689, 28.001298743120884),
Offset(34.250753459758215, 29.965231805952083),
Offset(33.049812698012744, 31.665455598707478),
Offset(31.665625287030675, 33.049668964316005),
Offset(30.233145163947302, 34.0899068761822),
Offset(28.95318331805556, 34.776098293102415),
Offset(28.25809331801544, 35.06918970385551),
Offset(28.2574725, 35.0694285),
],
<Offset>[
Offset(18.649202428774874, 22.9341391589153),
Offset(18.67383155907712, 22.83064248877585),
Offset(18.841306012706912, 22.31953234799544),
Offset(19.183223001397558, 21.65944760224325),
Offset(19.732070850474493, 21.015435554004174),
Offset(20.435551631861834, 20.468366312790188),
Offset(21.23060828396028, 20.041713905979922),
Offset(22.06715801213608, 19.735213871060157),
Offset(22.931677497903188, 19.55123899968618),
Offset(23.801199687383725, 19.506527080582764),
Offset(24.651711975751407, 19.606157294877438),
Offset(25.46261762389004, 19.84826250611138),
Offset(26.211862438102788, 20.22649117071362),
Offset(26.877529723485452, 20.729988226520383),
Offset(27.426530333642553, 21.327419665857633),
Offset(27.852796597051224, 21.998111345570546),
Offset(28.14340318787079, 22.70256984984598),
Offset(28.300380921474876, 23.40180362588746),
Offset(28.341515096912012, 24.048596657000438),
Offset(28.30302507047554, 24.578869773477106),
Offset(28.25752024905112, 24.851255719925685),
Offset(28.2574725, 24.8514945),
],
<Offset>[
Offset(18.649202428774874, 22.9341391589153),
Offset(18.67383155907712, 22.83064248877585),
Offset(18.841306012706912, 22.31953234799544),
Offset(19.183223001397558, 21.65944760224325),
Offset(19.732070850474493, 21.015435554004174),
Offset(20.435551631861834, 20.468366312790188),
Offset(21.23060828396028, 20.041713905979922),
Offset(22.06715801213608, 19.735213871060157),
Offset(22.931677497903188, 19.55123899968618),
Offset(23.801199687383725, 19.506527080582764),
Offset(24.651711975751407, 19.606157294877438),
Offset(25.46261762389004, 19.84826250611138),
Offset(26.211862438102788, 20.22649117071362),
Offset(26.877529723485452, 20.729988226520383),
Offset(27.426530333642553, 21.327419665857633),
Offset(27.852796597051224, 21.998111345570546),
Offset(28.14340318787079, 22.70256984984598),
Offset(28.300380921474876, 23.40180362588746),
Offset(28.341515096912012, 24.048596657000438),
Offset(28.30302507047554, 24.578869773477106),
Offset(28.25752024905112, 24.851255719925685),
Offset(28.2574725, 24.8514945),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(31.489132596718107, 22.924219143929935),
Offset(31.504692966387218, 23.070928234251795),
Offset(31.52158489969306, 23.816598935409147),
Offset(31.379117181752463, 24.837594520788468),
Offset(30.958629401377593, 25.933078514213545),
Offset(30.291186490892898, 26.97316019028753),
Offset(29.448413518215055, 27.898039484777154),
Offset(28.495925428255816, 28.68494709729183),
Offset(27.450311425963747, 29.324538614827237),
Offset(26.33388021776769, 29.784325981107337),
Offset(25.175688664843197, 30.046584449353226),
Offset(24.0035327197847, 30.10424947226514),
Offset(22.849183963690074, 29.955448055883483),
Offset(21.746312718586534, 29.604259883851242),
Offset(20.7526512563793, 29.076388283251973),
Offset(19.885676136669687, 28.39606820827754),
Offset(19.180517439009286, 27.608979359987934),
Offset(18.65251558304633, 26.76704799144326),
Offset(18.300204877730252, 25.940226724035732),
Offset(18.105796550850236, 25.229028021057122),
Offset(18.039586265121297, 24.851828788890007),
Offset(18.0395385, 24.851494500000005),
],
),
_PathCubicTo(
<Offset>[
Offset(31.489132596718107, 22.924219143929935),
Offset(31.504692966387218, 23.070928234251795),
Offset(31.52158489969306, 23.816598935409147),
Offset(31.379117181752463, 24.837594520788468),
Offset(30.958629401377593, 25.933078514213545),
Offset(30.291186490892898, 26.97316019028753),
Offset(29.448413518215055, 27.898039484777154),
Offset(28.495925428255816, 28.68494709729183),
Offset(27.450311425963747, 29.324538614827237),
Offset(26.33388021776769, 29.784325981107337),
Offset(25.175688664843197, 30.046584449353226),
Offset(24.0035327197847, 30.10424947226514),
Offset(22.849183963690074, 29.955448055883483),
Offset(21.746312718586534, 29.604259883851242),
Offset(20.7526512563793, 29.076388283251973),
Offset(19.885676136669687, 28.39606820827754),
Offset(19.180517439009286, 27.608979359987934),
Offset(18.65251558304633, 26.76704799144326),
Offset(18.300204877730252, 25.940226724035732),
Offset(18.105796550850236, 25.229028021057122),
Offset(18.039586265121297, 24.851828788890007),
Offset(18.0395385, 24.851494500000005),
],
<Offset>[
Offset(42.189074403337465, 22.915952464775465),
Offset(42.19707747247897, 23.271166355481746),
Offset(42.08848397218152, 25.06415442492057),
Offset(41.54236233204822, 27.486050286242815),
Offset(40.314094860463506, 30.03111431438802),
Offset(38.504215540085454, 32.39382175486865),
Offset(36.2965845467607, 34.44497746710818),
Offset(33.8532316083556, 36.143058119151554),
Offset(31.215839699347548, 37.46895496077811),
Offset(28.444447326420992, 38.34915839821115),
Offset(25.61233590575302, 38.74694041141639),
Offset(22.787628633030252, 38.650905277393264),
Offset(20.046951901679478, 38.062912126858365),
Offset(17.470298547837437, 36.99948626496029),
Offset(15.191085358659922, 35.53386213108059),
Offset(13.246409086351742, 33.72769892720004),
Offset(11.711445981624701, 31.697653951772896),
Offset(10.612627801022544, 29.571418296073094),
Offset(9.932446361745452, 27.516585113231805),
Offset(9.608106117829148, 25.77082656070714),
Offset(9.524641278513112, 24.852306346360272),
Offset(9.5245935, 24.851494500000005),
],
<Offset>[
Offset(42.189074403337465, 22.915952464775465),
Offset(42.19707747247897, 23.271166355481746),
Offset(42.08848397218152, 25.06415442492057),
Offset(41.54236233204822, 27.486050286242815),
Offset(40.314094860463506, 30.03111431438802),
Offset(38.504215540085454, 32.39382175486865),
Offset(36.2965845467607, 34.44497746710818),
Offset(33.8532316083556, 36.143058119151554),
Offset(31.215839699347548, 37.46895496077811),
Offset(28.444447326420992, 38.34915839821115),
Offset(25.61233590575302, 38.74694041141639),
Offset(22.787628633030252, 38.650905277393264),
Offset(20.046951901679478, 38.062912126858365),
Offset(17.470298547837437, 36.99948626496029),
Offset(15.191085358659922, 35.53386213108059),
Offset(13.246409086351742, 33.72769892720004),
Offset(11.711445981624701, 31.697653951772896),
Offset(10.612627801022544, 29.571418296073094),
Offset(9.932446361745452, 27.516585113231805),
Offset(9.608106117829148, 25.77082656070714),
Offset(9.524641278513112, 24.852306346360272),
Offset(9.5245935, 24.851494500000005),
],
),
_PathCubicTo(
<Offset>[
Offset(42.189074403337465, 22.915952464775465),
Offset(42.19707747247897, 23.271166355481746),
Offset(42.08848397218152, 25.06415442492057),
Offset(41.54236233204822, 27.486050286242815),
Offset(40.314094860463506, 30.03111431438802),
Offset(38.504215540085454, 32.39382175486865),
Offset(36.2965845467607, 34.44497746710818),
Offset(33.8532316083556, 36.143058119151554),
Offset(31.215839699347548, 37.46895496077811),
Offset(28.444447326420992, 38.34915839821115),
Offset(25.61233590575302, 38.74694041141639),
Offset(22.787628633030252, 38.650905277393264),
Offset(20.046951901679478, 38.062912126858365),
Offset(17.470298547837437, 36.99948626496029),
Offset(15.191085358659922, 35.53386213108059),
Offset(13.246409086351742, 33.72769892720004),
Offset(11.711445981624701, 31.697653951772896),
Offset(10.612627801022544, 29.571418296073094),
Offset(9.932446361745452, 27.516585113231805),
Offset(9.608106117829148, 25.77082656070714),
Offset(9.524641278513112, 24.852306346360272),
Offset(9.5245935, 24.851494500000005),
],
<Offset>[
Offset(42.1791543883521, 10.076022296832232),
Offset(42.43736321795492, 10.440304948171638),
Offset(43.58555055959523, 12.383875537934415),
Offset(44.72050925059344, 15.290156105887906),
Offset(45.231737820672876, 18.804555763484924),
Offset(45.00900941758279, 22.538186895837583),
Offset(44.15291012555793, 26.22717223285341),
Offset(42.80296483458727, 29.714290703031818),
Offset(40.9891393144886, 32.950321032717554),
Offset(38.72224622694557, 35.816477867827196),
Offset(36.05276306022881, 38.2229637223246),
Offset(33.04361559918401, 40.1099901814986),
Offset(29.775908786849342, 41.42559060127108),
Offset(26.3445702051683, 42.13070326985921),
Offset(22.940053976054262, 42.20774120834385),
Offset(19.644365949058738, 41.694819387581575),
Offset(16.617855491766655, 40.660539700634395),
Offset(13.977872166578344, 39.219283634501636),
Offset(11.824076428780742, 37.557895332413565),
Offset(10.258264365409168, 35.96805508033244),
Offset(9.525214347477434, 35.0702403302901),
Offset(9.524593500000002, 35.06942850000001),
],
<Offset>[
Offset(42.1791543883521, 10.076022296832232),
Offset(42.43736321795492, 10.440304948171638),
Offset(43.58555055959523, 12.383875537934415),
Offset(44.72050925059344, 15.290156105887906),
Offset(45.231737820672876, 18.804555763484924),
Offset(45.00900941758279, 22.538186895837583),
Offset(44.15291012555793, 26.22717223285341),
Offset(42.80296483458727, 29.714290703031818),
Offset(40.9891393144886, 32.950321032717554),
Offset(38.72224622694557, 35.816477867827196),
Offset(36.05276306022881, 38.2229637223246),
Offset(33.04361559918401, 40.1099901814986),
Offset(29.775908786849342, 41.42559060127108),
Offset(26.3445702051683, 42.13070326985921),
Offset(22.940053976054262, 42.20774120834385),
Offset(19.644365949058738, 41.694819387581575),
Offset(16.617855491766655, 40.660539700634395),
Offset(13.977872166578344, 39.219283634501636),
Offset(11.824076428780742, 37.557895332413565),
Offset(10.258264365409168, 35.96805508033244),
Offset(9.525214347477434, 35.0702403302901),
Offset(9.524593500000002, 35.06942850000001),
],
),
_PathCubicTo(
<Offset>[
Offset(42.1791543883521, 10.076022296832232),
Offset(42.43736321795492, 10.440304948171638),
Offset(43.58555055959523, 12.383875537934415),
Offset(44.72050925059344, 15.290156105887906),
Offset(45.231737820672876, 18.804555763484924),
Offset(45.00900941758279, 22.538186895837583),
Offset(44.15291012555793, 26.22717223285341),
Offset(42.80296483458727, 29.714290703031818),
Offset(40.9891393144886, 32.950321032717554),
Offset(38.72224622694557, 35.816477867827196),
Offset(36.05276306022881, 38.2229637223246),
Offset(33.04361559918401, 40.1099901814986),
Offset(29.775908786849342, 41.42559060127108),
Offset(26.3445702051683, 42.13070326985921),
Offset(22.940053976054262, 42.20774120834385),
Offset(19.644365949058738, 41.694819387581575),
Offset(16.617855491766655, 40.660539700634395),
Offset(13.977872166578344, 39.219283634501636),
Offset(11.824076428780742, 37.557895332413565),
Offset(10.258264365409168, 35.96805508033244),
Offset(9.525214347477434, 35.0702403302901),
Offset(9.524593500000002, 35.06942850000001),
],
<Offset>[
Offset(31.479212581732742, 10.084288975986702),
Offset(31.744978711863162, 10.240066826941685),
Offset(33.018651487106766, 11.136320048422991),
Offset(34.55726410029768, 12.641700340433559),
Offset(35.87627236158696, 14.706519963310448),
Offset(36.79598036839023, 17.117525331256466),
Offset(37.30473909701229, 19.680234250522382),
Offset(37.44565865448749, 22.256179681172092),
Offset(37.223611041104796, 24.805904686766674),
Offset(36.611679118292265, 27.25164545072338),
Offset(35.61611581931899, 29.522607760261437),
Offset(34.25951968593846, 31.563334376370474),
Offset(32.57814084885994, 33.3181265302962),
Offset(30.620584375917396, 34.73547688875016),
Offset(28.501619873773638, 35.75026736051523),
Offset(26.283632999376685, 36.36318866865908),
Offset(24.08692694915124, 36.57186510884944),
Offset(22.01775994860213, 36.41491332987181),
Offset(20.191834944765542, 35.98153694321749),
Offset(18.755954798430256, 35.42625654068243),
Offset(18.04015933408562, 35.06976277281983),
Offset(18.0395385, 35.0694285),
],
<Offset>[
Offset(31.479212581732742, 10.084288975986702),
Offset(31.744978711863162, 10.240066826941685),
Offset(33.018651487106766, 11.136320048422991),
Offset(34.55726410029768, 12.641700340433559),
Offset(35.87627236158696, 14.706519963310448),
Offset(36.79598036839023, 17.117525331256466),
Offset(37.30473909701229, 19.680234250522382),
Offset(37.44565865448749, 22.256179681172092),
Offset(37.223611041104796, 24.805904686766674),
Offset(36.611679118292265, 27.25164545072338),
Offset(35.61611581931899, 29.522607760261437),
Offset(34.25951968593846, 31.563334376370474),
Offset(32.57814084885994, 33.3181265302962),
Offset(30.620584375917396, 34.73547688875016),
Offset(28.501619873773638, 35.75026736051523),
Offset(26.283632999376685, 36.36318866865908),
Offset(24.08692694915124, 36.57186510884944),
Offset(22.01775994860213, 36.41491332987181),
Offset(20.191834944765542, 35.98153694321749),
Offset(18.755954798430256, 35.42625654068243),
Offset(18.04015933408562, 35.06976277281983),
Offset(18.0395385, 35.0694285),
],
),
_PathCubicTo(
<Offset>[
Offset(31.479212581732742, 10.084288975986702),
Offset(31.744978711863162, 10.240066826941685),
Offset(33.018651487106766, 11.136320048422991),
Offset(34.55726410029768, 12.641700340433559),
Offset(35.87627236158696, 14.706519963310448),
Offset(36.79598036839023, 17.117525331256466),
Offset(37.30473909701229, 19.680234250522382),
Offset(37.44565865448749, 22.256179681172092),
Offset(37.223611041104796, 24.805904686766674),
Offset(36.611679118292265, 27.25164545072338),
Offset(35.61611581931899, 29.522607760261437),
Offset(34.25951968593846, 31.563334376370474),
Offset(32.57814084885994, 33.3181265302962),
Offset(30.620584375917396, 34.73547688875016),
Offset(28.501619873773638, 35.75026736051523),
Offset(26.283632999376685, 36.36318866865908),
Offset(24.08692694915124, 36.57186510884944),
Offset(22.01775994860213, 36.41491332987181),
Offset(20.191834944765542, 35.98153694321749),
Offset(18.755954798430256, 35.42625654068243),
Offset(18.04015933408562, 35.06976277281983),
Offset(18.0395385, 35.0694285),
],
<Offset>[
Offset(31.489132596718107, 22.924219143929935),
Offset(31.504692966387218, 23.070928234251795),
Offset(31.52158489969306, 23.816598935409147),
Offset(31.379117181752463, 24.837594520788468),
Offset(30.958629401377593, 25.933078514213545),
Offset(30.291186490892898, 26.97316019028753),
Offset(29.448413518215055, 27.898039484777154),
Offset(28.495925428255816, 28.68494709729183),
Offset(27.450311425963747, 29.324538614827237),
Offset(26.33388021776769, 29.784325981107337),
Offset(25.175688664843197, 30.046584449353226),
Offset(24.0035327197847, 30.10424947226514),
Offset(22.849183963690074, 29.955448055883483),
Offset(21.746312718586534, 29.604259883851242),
Offset(20.7526512563793, 29.076388283251973),
Offset(19.885676136669687, 28.39606820827754),
Offset(19.180517439009286, 27.608979359987934),
Offset(18.65251558304633, 26.76704799144326),
Offset(18.300204877730252, 25.940226724035732),
Offset(18.105796550850236, 25.229028021057122),
Offset(18.039586265121297, 24.851828788890007),
Offset(18.0395385, 24.851494500000005),
],
<Offset>[
Offset(31.489132596718107, 22.924219143929935),
Offset(31.504692966387218, 23.070928234251795),
Offset(31.52158489969306, 23.816598935409147),
Offset(31.379117181752463, 24.837594520788468),
Offset(30.958629401377593, 25.933078514213545),
Offset(30.291186490892898, 26.97316019028753),
Offset(29.448413518215055, 27.898039484777154),
Offset(28.495925428255816, 28.68494709729183),
Offset(27.450311425963747, 29.324538614827237),
Offset(26.33388021776769, 29.784325981107337),
Offset(25.175688664843197, 30.046584449353226),
Offset(24.0035327197847, 30.10424947226514),
Offset(22.849183963690074, 29.955448055883483),
Offset(21.746312718586534, 29.604259883851242),
Offset(20.7526512563793, 29.076388283251973),
Offset(19.885676136669687, 28.39606820827754),
Offset(19.180517439009286, 27.608979359987934),
Offset(18.65251558304633, 26.76704799144326),
Offset(18.300204877730252, 25.940226724035732),
Offset(18.105796550850236, 25.229028021057122),
Offset(18.039586265121297, 24.851828788890007),
Offset(18.0395385, 24.851494500000005),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(5.820845611647898, 37.923977703167765),
Offset(5.562636782045075, 37.55969505182836),
Offset(4.414449440404765, 35.616124462065585),
Offset(3.279490749406561, 32.70984389411209),
Offset(2.7682621793271274, 29.195444236515087),
Offset(2.990990582417215, 25.461813104162424),
Offset(3.8470898744420694, 21.77282776714659),
Offset(5.197035165412721, 18.285709296968175),
Offset(7.010860685511399, 15.049678967282448),
Offset(9.277753773054428, 12.183522132172802),
Offset(11.947236939771194, 9.777036277675393),
Offset(14.956384400815995, 7.8900098185013965),
Offset(18.22409121315066, 6.574409398728922),
Offset(21.6554297948317, 5.869296730140784),
Offset(25.05994602394574, 5.792258791656161),
Offset(28.35563405094127, 6.305180612418426),
Offset(31.382144508233342, 7.339460299365608),
Offset(34.022127833421656, 8.780716365498357),
Offset(36.175923571219265, 10.44210466758643),
Offset(37.741735634590825, 12.031944919667563),
Offset(38.47478565252257, 12.929759669709906),
Offset(38.4754065, 12.930571500000003),
],
),
_PathCubicTo(
<Offset>[
Offset(5.820845611647898, 37.923977703167765),
Offset(5.562636782045075, 37.55969505182836),
Offset(4.414449440404765, 35.616124462065585),
Offset(3.279490749406561, 32.70984389411209),
Offset(2.7682621793271274, 29.195444236515087),
Offset(2.990990582417215, 25.461813104162424),
Offset(3.8470898744420694, 21.77282776714659),
Offset(5.197035165412721, 18.285709296968175),
Offset(7.010860685511399, 15.049678967282448),
Offset(9.277753773054428, 12.183522132172802),
Offset(11.947236939771194, 9.777036277675393),
Offset(14.956384400815995, 7.8900098185013965),
Offset(18.22409121315066, 6.574409398728922),
Offset(21.6554297948317, 5.869296730140784),
Offset(25.05994602394574, 5.792258791656161),
Offset(28.35563405094127, 6.305180612418426),
Offset(31.382144508233342, 7.339460299365608),
Offset(34.022127833421656, 8.780716365498357),
Offset(36.175923571219265, 10.44210466758643),
Offset(37.741735634590825, 12.031944919667563),
Offset(38.47478565252257, 12.929759669709906),
Offset(38.4754065, 12.930571500000003),
],
<Offset>[
Offset(16.520787418267258, 37.9157110240133),
Offset(16.25502128813683, 37.759933173058315),
Offset(14.981348512893227, 36.863679951577005),
Offset(13.442735899702317, 35.35829965956644),
Offset(12.123727638413042, 33.29348003668956),
Offset(11.204019631609766, 30.88247466874354),
Offset(10.695260902987714, 28.319765749477618),
Offset(10.554341345512503, 25.7438203188279),
Offset(10.7763889588952, 23.194095313233326),
Offset(11.38832088170773, 20.74835454927662),
Offset(12.383884180681019, 18.477392239738556),
Offset(13.740480314061546, 16.436665623629526),
Offset(15.421859151140067, 14.681873469703806),
Offset(17.379415624082604, 13.264523111249835),
Offset(19.498380126226365, 12.249732639484778),
Offset(21.716367000623322, 11.636811331340922),
Offset(23.91307305084876, 11.42813489115057),
Offset(25.98224005139787, 11.585086670128192),
Offset(27.808165055234465, 12.018463056782506),
Offset(29.244045201569737, 12.57374345931758),
Offset(29.95984066591438, 12.930237227180172),
Offset(29.9604615, 12.930571500000003),
],
<Offset>[
Offset(16.520787418267258, 37.9157110240133),
Offset(16.25502128813683, 37.759933173058315),
Offset(14.981348512893227, 36.863679951577005),
Offset(13.442735899702317, 35.35829965956644),
Offset(12.123727638413042, 33.29348003668956),
Offset(11.204019631609766, 30.88247466874354),
Offset(10.695260902987714, 28.319765749477618),
Offset(10.554341345512503, 25.7438203188279),
Offset(10.7763889588952, 23.194095313233326),
Offset(11.38832088170773, 20.74835454927662),
Offset(12.383884180681019, 18.477392239738556),
Offset(13.740480314061546, 16.436665623629526),
Offset(15.421859151140067, 14.681873469703806),
Offset(17.379415624082604, 13.264523111249835),
Offset(19.498380126226365, 12.249732639484778),
Offset(21.716367000623322, 11.636811331340922),
Offset(23.91307305084876, 11.42813489115057),
Offset(25.98224005139787, 11.585086670128192),
Offset(27.808165055234465, 12.018463056782506),
Offset(29.244045201569737, 12.57374345931758),
Offset(29.95984066591438, 12.930237227180172),
Offset(29.9604615, 12.930571500000003),
],
),
_PathCubicTo(
<Offset>[
Offset(16.520787418267258, 37.9157110240133),
Offset(16.25502128813683, 37.759933173058315),
Offset(14.981348512893227, 36.863679951577005),
Offset(13.442735899702317, 35.35829965956644),
Offset(12.123727638413042, 33.29348003668956),
Offset(11.204019631609766, 30.88247466874354),
Offset(10.695260902987714, 28.319765749477618),
Offset(10.554341345512503, 25.7438203188279),
Offset(10.7763889588952, 23.194095313233326),
Offset(11.38832088170773, 20.74835454927662),
Offset(12.383884180681019, 18.477392239738556),
Offset(13.740480314061546, 16.436665623629526),
Offset(15.421859151140067, 14.681873469703806),
Offset(17.379415624082604, 13.264523111249835),
Offset(19.498380126226365, 12.249732639484778),
Offset(21.716367000623322, 11.636811331340922),
Offset(23.91307305084876, 11.42813489115057),
Offset(25.98224005139787, 11.585086670128192),
Offset(27.808165055234465, 12.018463056782506),
Offset(29.244045201569737, 12.57374345931758),
Offset(29.95984066591438, 12.930237227180172),
Offset(29.9604615, 12.930571500000003),
],
<Offset>[
Offset(16.510867403281896, 25.075780856070065),
Offset(16.495307033612775, 24.929071765748205),
Offset(16.478415100306933, 24.183401064590853),
Offset(16.620882818247537, 23.16240547921153),
Offset(17.041370598622414, 22.066921485786466),
Offset(17.708813509107102, 21.026839809712477),
Offset(18.55158648178495, 20.101960515222846),
Offset(19.504074571744177, 19.315052902708164),
Offset(20.54968857403625, 18.675461385172763),
Offset(21.666119782232308, 18.215674018892656),
Offset(22.824311335156814, 17.95341555064677),
Offset(23.996467280215303, 17.89575052773486),
Offset(25.15081603630993, 18.04455194411652),
Offset(26.253687281413466, 18.39574011614875),
Offset(27.247348743620705, 18.923611716748034),
Offset(28.114323863330313, 19.60393179172246),
Offset(28.81948256099071, 20.39102064001207),
Offset(29.34748441695367, 21.232952008556737),
Offset(29.699795122269755, 22.059773275964268),
Offset(29.894203449149757, 22.770971978942885),
Offset(29.960413734878703, 23.148171211109993),
Offset(29.9604615, 23.148505500000002),
],
<Offset>[
Offset(16.510867403281896, 25.075780856070065),
Offset(16.495307033612775, 24.929071765748205),
Offset(16.478415100306933, 24.183401064590853),
Offset(16.620882818247537, 23.16240547921153),
Offset(17.041370598622414, 22.066921485786466),
Offset(17.708813509107102, 21.026839809712477),
Offset(18.55158648178495, 20.101960515222846),
Offset(19.504074571744177, 19.315052902708164),
Offset(20.54968857403625, 18.675461385172763),
Offset(21.666119782232308, 18.215674018892656),
Offset(22.824311335156814, 17.95341555064677),
Offset(23.996467280215303, 17.89575052773486),
Offset(25.15081603630993, 18.04455194411652),
Offset(26.253687281413466, 18.39574011614875),
Offset(27.247348743620705, 18.923611716748034),
Offset(28.114323863330313, 19.60393179172246),
Offset(28.81948256099071, 20.39102064001207),
Offset(29.34748441695367, 21.232952008556737),
Offset(29.699795122269755, 22.059773275964268),
Offset(29.894203449149757, 22.770971978942885),
Offset(29.960413734878703, 23.148171211109993),
Offset(29.9604615, 23.148505500000002),
],
),
_PathCubicTo(
<Offset>[
Offset(16.510867403281896, 25.075780856070065),
Offset(16.495307033612775, 24.929071765748205),
Offset(16.478415100306933, 24.183401064590853),
Offset(16.620882818247537, 23.16240547921153),
Offset(17.041370598622414, 22.066921485786466),
Offset(17.708813509107102, 21.026839809712477),
Offset(18.55158648178495, 20.101960515222846),
Offset(19.504074571744177, 19.315052902708164),
Offset(20.54968857403625, 18.675461385172763),
Offset(21.666119782232308, 18.215674018892656),
Offset(22.824311335156814, 17.95341555064677),
Offset(23.996467280215303, 17.89575052773486),
Offset(25.15081603630993, 18.04455194411652),
Offset(26.253687281413466, 18.39574011614875),
Offset(27.247348743620705, 18.923611716748034),
Offset(28.114323863330313, 19.60393179172246),
Offset(28.81948256099071, 20.39102064001207),
Offset(29.34748441695367, 21.232952008556737),
Offset(29.699795122269755, 22.059773275964268),
Offset(29.894203449149757, 22.770971978942885),
Offset(29.960413734878703, 23.148171211109993),
Offset(29.9604615, 23.148505500000002),
],
<Offset>[
Offset(5.810925596662535, 25.084047535224535),
Offset(5.8029225275210194, 24.728833644518254),
Offset(5.911516027818471, 22.93584557507943),
Offset(6.457637667951779, 20.51394971375718),
Offset(7.6859051395365, 17.96888568561199),
Offset(9.495784459914551, 15.606178245131362),
Offset(11.703415453239304, 13.555022532891817),
Offset(14.146768391644395, 11.856941880848437),
Offset(16.78416030065245, 10.531045039221889),
Offset(19.555552673579008, 9.650841601788843),
Offset(22.38766409424699, 9.253059588583607),
Offset(25.21237136696975, 9.349094722606733),
Offset(27.953048098320522, 9.937087873141635),
Offset(30.529701452162563, 11.000513735039702),
Offset(32.80891464134008, 12.466137868919416),
Offset(34.75359091364826, 14.272301072799962),
Offset(36.288554018375294, 16.302346048227108),
Offset(37.38737219897746, 18.428581703926902),
Offset(38.06755363825456, 20.483414886768188),
Offset(38.39189388217084, 22.229173439292868),
Offset(38.475358721486884, 23.147693653639728),
Offset(38.4754065, 23.148505500000002),
],
<Offset>[
Offset(5.810925596662535, 25.084047535224535),
Offset(5.8029225275210194, 24.728833644518254),
Offset(5.911516027818471, 22.93584557507943),
Offset(6.457637667951779, 20.51394971375718),
Offset(7.6859051395365, 17.96888568561199),
Offset(9.495784459914551, 15.606178245131362),
Offset(11.703415453239304, 13.555022532891817),
Offset(14.146768391644395, 11.856941880848437),
Offset(16.78416030065245, 10.531045039221889),
Offset(19.555552673579008, 9.650841601788843),
Offset(22.38766409424699, 9.253059588583607),
Offset(25.21237136696975, 9.349094722606733),
Offset(27.953048098320522, 9.937087873141635),
Offset(30.529701452162563, 11.000513735039702),
Offset(32.80891464134008, 12.466137868919416),
Offset(34.75359091364826, 14.272301072799962),
Offset(36.288554018375294, 16.302346048227108),
Offset(37.38737219897746, 18.428581703926902),
Offset(38.06755363825456, 20.483414886768188),
Offset(38.39189388217084, 22.229173439292868),
Offset(38.475358721486884, 23.147693653639728),
Offset(38.4754065, 23.148505500000002),
],
),
_PathCubicTo(
<Offset>[
Offset(5.810925596662535, 25.084047535224535),
Offset(5.8029225275210194, 24.728833644518254),
Offset(5.911516027818471, 22.93584557507943),
Offset(6.457637667951779, 20.51394971375718),
Offset(7.6859051395365, 17.96888568561199),
Offset(9.495784459914551, 15.606178245131362),
Offset(11.703415453239304, 13.555022532891817),
Offset(14.146768391644395, 11.856941880848437),
Offset(16.78416030065245, 10.531045039221889),
Offset(19.555552673579008, 9.650841601788843),
Offset(22.38766409424699, 9.253059588583607),
Offset(25.21237136696975, 9.349094722606733),
Offset(27.953048098320522, 9.937087873141635),
Offset(30.529701452162563, 11.000513735039702),
Offset(32.80891464134008, 12.466137868919416),
Offset(34.75359091364826, 14.272301072799962),
Offset(36.288554018375294, 16.302346048227108),
Offset(37.38737219897746, 18.428581703926902),
Offset(38.06755363825456, 20.483414886768188),
Offset(38.39189388217084, 22.229173439292868),
Offset(38.475358721486884, 23.147693653639728),
Offset(38.4754065, 23.148505500000002),
],
<Offset>[
Offset(5.820845611647898, 37.923977703167765),
Offset(5.562636782045075, 37.55969505182836),
Offset(4.414449440404765, 35.616124462065585),
Offset(3.279490749406561, 32.70984389411209),
Offset(2.7682621793271274, 29.195444236515087),
Offset(2.990990582417215, 25.461813104162424),
Offset(3.8470898744420694, 21.77282776714659),
Offset(5.197035165412721, 18.285709296968175),
Offset(7.010860685511399, 15.049678967282448),
Offset(9.277753773054428, 12.183522132172802),
Offset(11.947236939771194, 9.777036277675393),
Offset(14.956384400815995, 7.8900098185013965),
Offset(18.22409121315066, 6.574409398728922),
Offset(21.6554297948317, 5.869296730140784),
Offset(25.05994602394574, 5.792258791656161),
Offset(28.35563405094127, 6.305180612418426),
Offset(31.382144508233342, 7.339460299365608),
Offset(34.022127833421656, 8.780716365498357),
Offset(36.175923571219265, 10.44210466758643),
Offset(37.741735634590825, 12.031944919667563),
Offset(38.47478565252257, 12.929759669709906),
Offset(38.4754065, 12.930571500000003),
],
<Offset>[
Offset(5.820845611647898, 37.923977703167765),
Offset(5.562636782045075, 37.55969505182836),
Offset(4.414449440404765, 35.616124462065585),
Offset(3.279490749406561, 32.70984389411209),
Offset(2.7682621793271274, 29.195444236515087),
Offset(2.990990582417215, 25.461813104162424),
Offset(3.8470898744420694, 21.77282776714659),
Offset(5.197035165412721, 18.285709296968175),
Offset(7.010860685511399, 15.049678967282448),
Offset(9.277753773054428, 12.183522132172802),
Offset(11.947236939771194, 9.777036277675393),
Offset(14.956384400815995, 7.8900098185013965),
Offset(18.22409121315066, 6.574409398728922),
Offset(21.6554297948317, 5.869296730140784),
Offset(25.05994602394574, 5.792258791656161),
Offset(28.35563405094127, 6.305180612418426),
Offset(31.382144508233342, 7.339460299365608),
Offset(34.022127833421656, 8.780716365498357),
Offset(36.175923571219265, 10.44210466758643),
Offset(37.741735634590825, 12.031944919667563),
Offset(38.47478565252257, 12.929759669709906),
Offset(38.4754065, 12.930571500000003),
],
),
_PathClose(
),
],
),
_PathFrames(
opacities: <double>[
1.0,
1.0,
1.0,
1.0,
1.0,
0.390243902439,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
],
commands: <_PathCommand>[
_PathMoveTo(
<Offset>[
Offset(18.66077577959113, 37.914057688182396),
Offset(18.393498189355185, 37.79998079730431),
Offset(17.09472832739092, 37.11319104947929),
Offset(15.475384929761471, 35.88799081265731),
Offset(13.994820730230222, 34.11308719672446),
Offset(12.846625441448277, 31.966606981659766),
Offset(12.064895108696843, 29.629153345943823),
Offset(11.625802581532461, 27.235442523199854),
Offset(11.529494613571963, 24.822978582423502),
Offset(11.810434303438388, 22.461321032697384),
Offset(12.47121362886298, 20.217463432151188),
Offset(13.49729949671066, 18.145996784655154),
Offset(14.861412738737947, 16.303366283898786),
Offset(16.52421278993278, 14.743568387471647),
Offset(18.38606694668249, 13.541227409050501),
Offset(20.388513590559725, 12.70313747512542),
Offset(22.419258759371843, 12.24586980950756),
Offset(24.37426249499311, 12.145960731054156),
Offset(26.134613352037505, 12.33373473462172),
Offset(27.54450711496552, 12.682103167247583),
Offset(28.256851668592745, 12.930332738674227),
Offset(28.257472499999995, 12.930571500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(18.66077577959113, 37.914057688182396),
Offset(18.393498189355185, 37.79998079730431),
Offset(17.09472832739092, 37.11319104947929),
Offset(15.475384929761471, 35.88799081265731),
Offset(13.994820730230222, 34.11308719672446),
Offset(12.846625441448277, 31.966606981659766),
Offset(12.064895108696843, 29.629153345943823),
Offset(11.625802581532461, 27.235442523199854),
Offset(11.529494613571963, 24.822978582423502),
Offset(11.810434303438388, 22.461321032697384),
Offset(12.47121362886298, 20.217463432151188),
Offset(13.49729949671066, 18.145996784655154),
Offset(14.861412738737947, 16.303366283898786),
Offset(16.52421278993278, 14.743568387471647),
Offset(18.38606694668249, 13.541227409050501),
Offset(20.388513590559725, 12.70313747512542),
Offset(22.419258759371843, 12.24586980950756),
Offset(24.37426249499311, 12.145960731054156),
Offset(26.134613352037505, 12.33373473462172),
Offset(27.54450711496552, 12.682103167247583),
Offset(28.256851668592745, 12.930332738674227),
Offset(28.257472499999995, 12.930571500000006),
],
<Offset>[
Offset(29.36071758621049, 37.90579100902793),
Offset(29.08588269544694, 38.00021891853426),
Offset(27.661627399879382, 38.36074653899071),
Offset(25.638630080057226, 38.53644657811165),
Offset(23.350286189316137, 38.211122996898936),
Offset(21.059654490640828, 37.38726854624088),
Offset(18.913066137242488, 36.17609132827485),
Offset(16.983108761632245, 34.69355354505958),
Offset(15.295022886955763, 32.967394928374375),
Offset(13.92100141209169, 31.0261534498012),
Offset(12.907860869772804, 28.91781939421435),
Offset(12.281395409956211, 26.692652589783282),
Offset(12.059180676727353, 24.41083035487367),
Offset(12.24819861918368, 22.1387947685807),
Offset(12.824501048963114, 19.99870125687912),
Offset(13.74924654024178, 18.034768194047917),
Offset(14.950187301987258, 16.334544401292522),
Offset(16.334374712969325, 14.950331035683991),
Offset(17.766854836052705, 13.910093123817797),
Offset(19.04681668194443, 13.2239017068976),
Offset(19.74190668198456, 12.930810296144493),
Offset(19.742527499999994, 12.930571500000006),
],
<Offset>[
Offset(29.36071758621049, 37.90579100902793),
Offset(29.08588269544694, 38.00021891853426),
Offset(27.661627399879382, 38.36074653899071),
Offset(25.638630080057226, 38.53644657811165),
Offset(23.350286189316137, 38.211122996898936),
Offset(21.059654490640828, 37.38726854624088),
Offset(18.913066137242488, 36.17609132827485),
Offset(16.983108761632245, 34.69355354505958),
Offset(15.295022886955763, 32.967394928374375),
Offset(13.92100141209169, 31.0261534498012),
Offset(12.907860869772804, 28.91781939421435),
Offset(12.281395409956211, 26.692652589783282),
Offset(12.059180676727353, 24.41083035487367),
Offset(12.24819861918368, 22.1387947685807),
Offset(12.824501048963114, 19.99870125687912),
Offset(13.74924654024178, 18.034768194047917),
Offset(14.950187301987258, 16.334544401292522),
Offset(16.334374712969325, 14.950331035683991),
Offset(17.766854836052705, 13.910093123817797),
Offset(19.04681668194443, 13.2239017068976),
Offset(19.74190668198456, 12.930810296144493),
Offset(19.742527499999994, 12.930571500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(29.36071758621049, 37.90579100902793),
Offset(29.08588269544694, 38.00021891853426),
Offset(27.661627399879382, 38.36074653899071),
Offset(25.638630080057226, 38.53644657811165),
Offset(23.350286189316137, 38.211122996898936),
Offset(21.059654490640828, 37.38726854624088),
Offset(18.913066137242488, 36.17609132827485),
Offset(16.983108761632245, 34.69355354505958),
Offset(15.295022886955763, 32.967394928374375),
Offset(13.92100141209169, 31.0261534498012),
Offset(12.907860869772804, 28.91781939421435),
Offset(12.281395409956211, 26.692652589783282),
Offset(12.059180676727353, 24.41083035487367),
Offset(12.24819861918368, 22.1387947685807),
Offset(12.824501048963114, 19.99870125687912),
Offset(13.74924654024178, 18.034768194047917),
Offset(14.950187301987258, 16.334544401292522),
Offset(16.334374712969325, 14.950331035683991),
Offset(17.766854836052705, 13.910093123817797),
Offset(19.04681668194443, 13.2239017068976),
Offset(19.74190668198456, 12.930810296144493),
Offset(19.742527499999994, 12.930571500000006),
],
<Offset>[
Offset(29.350797571225126, 25.065860841084696),
Offset(29.326168440922885, 25.16935751122415),
Offset(29.158693987293088, 25.68046765200456),
Offset(28.816776998602446, 26.340552397756746),
Offset(28.267929149525507, 26.984564445995836),
Offset(27.564448368138166, 27.53163368720982),
Offset(26.76939171603972, 27.958286094020078),
Offset(25.932841987863917, 28.264786128939843),
Offset(25.068322502096812, 28.448761000313816),
Offset(24.198800312616267, 28.493472919417236),
Offset(23.3482880242486, 28.393842705122562),
Offset(22.537382376109967, 28.151737493888618),
Offset(21.788137561897216, 27.77350882928638),
Offset(21.122470276514544, 27.270011773479617),
Offset(20.573469666357454, 26.672580334142374),
Offset(20.147203402948776, 26.001888654429454),
Offset(19.85659681212921, 25.29743015015402),
Offset(19.699619078525124, 24.598196374112536),
Offset(19.658484903087995, 23.951403342999555),
Offset(19.69697492952445, 23.421130226522905),
Offset(19.74247975094888, 23.148744280074315),
Offset(19.742527499999998, 23.148505500000006),
],
<Offset>[
Offset(29.350797571225126, 25.065860841084696),
Offset(29.326168440922885, 25.16935751122415),
Offset(29.158693987293088, 25.68046765200456),
Offset(28.816776998602446, 26.340552397756746),
Offset(28.267929149525507, 26.984564445995836),
Offset(27.564448368138166, 27.53163368720982),
Offset(26.76939171603972, 27.958286094020078),
Offset(25.932841987863917, 28.264786128939843),
Offset(25.068322502096812, 28.448761000313816),
Offset(24.198800312616267, 28.493472919417236),
Offset(23.3482880242486, 28.393842705122562),
Offset(22.537382376109967, 28.151737493888618),
Offset(21.788137561897216, 27.77350882928638),
Offset(21.122470276514544, 27.270011773479617),
Offset(20.573469666357454, 26.672580334142374),
Offset(20.147203402948776, 26.001888654429454),
Offset(19.85659681212921, 25.29743015015402),
Offset(19.699619078525124, 24.598196374112536),
Offset(19.658484903087995, 23.951403342999555),
Offset(19.69697492952445, 23.421130226522905),
Offset(19.74247975094888, 23.148744280074315),
Offset(19.742527499999998, 23.148505500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(29.350797571225126, 25.065860841084696),
Offset(29.326168440922885, 25.16935751122415),
Offset(29.158693987293088, 25.68046765200456),
Offset(28.816776998602446, 26.340552397756746),
Offset(28.267929149525507, 26.984564445995836),
Offset(27.564448368138166, 27.53163368720982),
Offset(26.76939171603972, 27.958286094020078),
Offset(25.932841987863917, 28.264786128939843),
Offset(25.068322502096812, 28.448761000313816),
Offset(24.198800312616267, 28.493472919417236),
Offset(23.3482880242486, 28.393842705122562),
Offset(22.537382376109967, 28.151737493888618),
Offset(21.788137561897216, 27.77350882928638),
Offset(21.122470276514544, 27.270011773479617),
Offset(20.573469666357454, 26.672580334142374),
Offset(20.147203402948776, 26.001888654429454),
Offset(19.85659681212921, 25.29743015015402),
Offset(19.699619078525124, 24.598196374112536),
Offset(19.658484903087995, 23.951403342999555),
Offset(19.69697492952445, 23.421130226522905),
Offset(19.74247975094888, 23.148744280074315),
Offset(19.742527499999998, 23.148505500000006),
],
<Offset>[
Offset(18.650855764605765, 25.074127520239166),
Offset(18.63378393483113, 24.969119389994198),
Offset(18.591794914804627, 24.432912162493135),
Offset(18.65353184830669, 23.6920966323024),
Offset(18.912463690439594, 22.88652864582136),
Offset(19.351419318945613, 22.110972122628702),
Offset(19.921220687494078, 21.41134811168905),
Offset(20.575535807764133, 20.806675107080117),
Offset(21.30279422871301, 20.304344654362943),
Offset(22.088233203962965, 19.92864050231342),
Offset(22.911640783338775, 19.6934867430594),
Offset(23.753286462864416, 19.60508168876049),
Offset(24.59036962390781, 19.666044758311497),
Offset(25.39848444726364, 19.874785392370566),
Offset(26.13503556407683, 20.215106486313754),
Offset(26.786470453266723, 20.670257935506957),
Offset(27.3256682695138, 21.20875555836906),
Offset(27.73950686054891, 21.7938260694827),
Offset(28.026243419072795, 22.37504495380348),
Offset(28.19466536254554, 22.879331686872888),
Offset(28.257424737557066, 23.14826672260405),
Offset(28.2574725, 23.148505500000006),
],
<Offset>[
Offset(18.650855764605765, 25.074127520239166),
Offset(18.63378393483113, 24.969119389994198),
Offset(18.591794914804627, 24.432912162493135),
Offset(18.65353184830669, 23.6920966323024),
Offset(18.912463690439594, 22.88652864582136),
Offset(19.351419318945613, 22.110972122628702),
Offset(19.921220687494078, 21.41134811168905),
Offset(20.575535807764133, 20.806675107080117),
Offset(21.30279422871301, 20.304344654362943),
Offset(22.088233203962965, 19.92864050231342),
Offset(22.911640783338775, 19.6934867430594),
Offset(23.753286462864416, 19.60508168876049),
Offset(24.59036962390781, 19.666044758311497),
Offset(25.39848444726364, 19.874785392370566),
Offset(26.13503556407683, 20.215106486313754),
Offset(26.786470453266723, 20.670257935506957),
Offset(27.3256682695138, 21.20875555836906),
Offset(27.73950686054891, 21.7938260694827),
Offset(28.026243419072795, 22.37504495380348),
Offset(28.19466536254554, 22.879331686872888),
Offset(28.257424737557066, 23.14826672260405),
Offset(28.2574725, 23.148505500000006),
],
),
_PathCubicTo(
<Offset>[
Offset(18.650855764605765, 25.074127520239166),
Offset(18.63378393483113, 24.969119389994198),
Offset(18.591794914804627, 24.432912162493135),
Offset(18.65353184830669, 23.6920966323024),
Offset(18.912463690439594, 22.88652864582136),
Offset(19.351419318945613, 22.110972122628702),
Offset(19.921220687494078, 21.41134811168905),
Offset(20.575535807764133, 20.806675107080117),
Offset(21.30279422871301, 20.304344654362943),
Offset(22.088233203962965, 19.92864050231342),
Offset(22.911640783338775, 19.6934867430594),
Offset(23.753286462864416, 19.60508168876049),
Offset(24.59036962390781, 19.666044758311497),
Offset(25.39848444726364, 19.874785392370566),
Offset(26.13503556407683, 20.215106486313754),
Offset(26.786470453266723, 20.670257935506957),
Offset(27.3256682695138, 21.20875555836906),
Offset(27.73950686054891, 21.7938260694827),
Offset(28.026243419072795, 22.37504495380348),
Offset(28.19466536254554, 22.879331686872888),
Offset(28.257424737557066, 23.14826672260405),
Offset(28.2574725, 23.148505500000006),
],
<Offset>[
Offset(18.66077577959113, 37.914057688182396),
Offset(18.393498189355185, 37.79998079730431),
Offset(17.09472832739092, 37.11319104947929),
Offset(15.475384929761471, 35.88799081265731),
Offset(13.994820730230222, 34.11308719672446),
Offset(12.846625441448277, 31.966606981659766),
Offset(12.064895108696843, 29.629153345943823),
Offset(11.625802581532461, 27.235442523199854),
Offset(11.529494613571963, 24.822978582423502),
Offset(11.810434303438388, 22.461321032697384),
Offset(12.47121362886298, 20.217463432151188),
Offset(13.49729949671066, 18.145996784655154),
Offset(14.861412738737947, 16.303366283898786),
Offset(16.52421278993278, 14.743568387471647),
Offset(18.38606694668249, 13.541227409050501),
Offset(20.388513590559725, 12.70313747512542),
Offset(22.419258759371843, 12.24586980950756),
Offset(24.37426249499311, 12.145960731054156),
Offset(26.134613352037505, 12.33373473462172),
Offset(27.54450711496552, 12.682103167247583),
Offset(28.256851668592745, 12.930332738674227),
Offset(28.257472499999995, 12.930571500000006),
],
<Offset>[
Offset(18.66077577959113, 37.914057688182396),
Offset(18.393498189355185, 37.79998079730431),
Offset(17.09472832739092, 37.11319104947929),
Offset(15.475384929761471, 35.88799081265731),
Offset(13.994820730230222, 34.11308719672446),
Offset(12.846625441448277, 31.966606981659766),
Offset(12.064895108696843, 29.629153345943823),
Offset(11.625802581532461, 27.235442523199854),
Offset(11.529494613571963, 24.822978582423502),
Offset(11.810434303438388, 22.461321032697384),
Offset(12.47121362886298, 20.217463432151188),
Offset(13.49729949671066, 18.145996784655154),
Offset(14.861412738737947, 16.303366283898786),
Offset(16.52421278993278, 14.743568387471647),
Offset(18.38606694668249, 13.541227409050501),
Offset(20.388513590559725, 12.70313747512542),
Offset(22.419258759371843, 12.24586980950756),
Offset(24.37426249499311, 12.145960731054156),
Offset(26.134613352037505, 12.33373473462172),
Offset(27.54450711496552, 12.682103167247583),
Offset(28.256851668592745, 12.930332738674227),
Offset(28.257472499999995, 12.930571500000006),
],
),
_PathClose(
),
],
),
],
matchTextDirection: true,
);
| flutter/packages/flutter/lib/src/material/animated_icons/data/view_list.g.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/material/animated_icons/data/view_list.g.dart",
"repo_id": "flutter",
"token_count": 124150
} | 796 |
// 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 'dart:ui' show lerpDouble;
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
/// Defines default property values for [BottomSheet]'s [Material].
///
/// Descendant widgets obtain the current [BottomSheetThemeData] object
/// using `Theme.of(context).bottomSheetTheme`. Instances of
/// [BottomSheetThemeData] can be customized with
/// [BottomSheetThemeData.copyWith].
///
/// Typically a [BottomSheetThemeData] is specified as part of the
/// overall [Theme] with [ThemeData.bottomSheetTheme].
///
/// All [BottomSheetThemeData] properties are `null` by default.
/// When null, the [BottomSheet] will provide its own defaults.
///
/// See also:
///
/// * [ThemeData], which describes the overall theme information for the
/// application.
@immutable
class BottomSheetThemeData with Diagnosticable {
/// Creates a theme that can be used for [ThemeData.bottomSheetTheme].
const BottomSheetThemeData({
this.backgroundColor,
this.surfaceTintColor,
this.elevation,
this.modalBackgroundColor,
this.modalBarrierColor,
this.shadowColor,
this.modalElevation,
this.shape,
this.showDragHandle,
this.dragHandleColor,
this.dragHandleSize,
this.clipBehavior,
this.constraints,
});
/// Overrides the default value for [BottomSheet.backgroundColor].
///
/// If null, [BottomSheet] defaults to [Material]'s default.
final Color? backgroundColor;
/// Overrides the default value for surfaceTintColor.
///
/// If null, [BottomSheet] will not display an overlay color.
///
/// See [Material.surfaceTintColor] for more details.
final Color? surfaceTintColor;
/// Overrides the default value for [BottomSheet.elevation].
///
/// {@macro flutter.material.material.elevation}
///
/// If null, [BottomSheet] defaults to 0.0.
final double? elevation;
/// Value for [BottomSheet.backgroundColor] when the Bottom sheet is presented
/// as a modal bottom sheet.
final Color? modalBackgroundColor;
/// Overrides the default value for barrier color when the Bottom sheet is presented as
/// a modal bottom sheet.
final Color? modalBarrierColor;
/// Overrides the default value for [BottomSheet.shadowColor].
final Color? shadowColor;
/// Value for [BottomSheet.elevation] when the Bottom sheet is presented as a
/// modal bottom sheet.
final double? modalElevation;
/// Overrides the default value for [BottomSheet.shape].
///
/// If null, no overriding shape is specified for [BottomSheet], so the
/// [BottomSheet] is rectangular.
final ShapeBorder? shape;
/// Overrides the default value for [BottomSheet.showDragHandle].
final bool? showDragHandle;
/// Overrides the default value for [BottomSheet.dragHandleColor].
final Color? dragHandleColor;
/// Overrides the default value for [BottomSheet.dragHandleSize].
final Size? dragHandleSize;
/// Overrides the default value for [BottomSheet.clipBehavior].
///
/// If null, [BottomSheet] uses [Clip.none].
final Clip? clipBehavior;
/// Constrains the size of the [BottomSheet].
///
/// If null, the bottom sheet's size will be unconstrained.
final BoxConstraints? constraints;
/// Creates a copy of this object with the given fields replaced with the
/// new values.
BottomSheetThemeData copyWith({
Color? backgroundColor,
Color? surfaceTintColor,
double? elevation,
Color? modalBackgroundColor,
Color? modalBarrierColor,
Color? shadowColor,
double? modalElevation,
ShapeBorder? shape,
bool? showDragHandle,
Color? dragHandleColor,
Size? dragHandleSize,
Clip? clipBehavior,
BoxConstraints? constraints,
}) {
return BottomSheetThemeData(
backgroundColor: backgroundColor ?? this.backgroundColor,
surfaceTintColor: surfaceTintColor ?? this.surfaceTintColor,
elevation: elevation ?? this.elevation,
modalBackgroundColor: modalBackgroundColor ?? this.modalBackgroundColor,
modalBarrierColor: modalBarrierColor ?? this.modalBarrierColor,
shadowColor: shadowColor ?? this.shadowColor,
modalElevation: modalElevation ?? this.modalElevation,
shape: shape ?? this.shape,
showDragHandle: showDragHandle ?? this.showDragHandle,
dragHandleColor: dragHandleColor ?? this.dragHandleColor,
dragHandleSize: dragHandleSize ?? this.dragHandleSize,
clipBehavior: clipBehavior ?? this.clipBehavior,
constraints: constraints ?? this.constraints,
);
}
/// Linearly interpolate between two bottom sheet themes.
///
/// If both arguments are null then null is returned.
///
/// {@macro dart.ui.shadow.lerp}
static BottomSheetThemeData? lerp(BottomSheetThemeData? a, BottomSheetThemeData? b, double t) {
if (identical(a, b)) {
return a;
}
return BottomSheetThemeData(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
surfaceTintColor: Color.lerp(a?.surfaceTintColor, b?.surfaceTintColor, t),
elevation: lerpDouble(a?.elevation, b?.elevation, t),
modalBackgroundColor: Color.lerp(a?.modalBackgroundColor, b?.modalBackgroundColor, t),
modalBarrierColor: Color.lerp(a?.modalBarrierColor, b?.modalBarrierColor, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
modalElevation: lerpDouble(a?.modalElevation, b?.modalElevation, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
showDragHandle: t < 0.5 ? a?.showDragHandle : b?.showDragHandle,
dragHandleColor: Color.lerp(a?.dragHandleColor, b?.dragHandleColor, t),
dragHandleSize: Size.lerp(a?.dragHandleSize, b?.dragHandleSize, t),
clipBehavior: t < 0.5 ? a?.clipBehavior : b?.clipBehavior,
constraints: BoxConstraints.lerp(a?.constraints, b?.constraints, t),
);
}
@override
int get hashCode => Object.hash(
backgroundColor,
surfaceTintColor,
elevation,
modalBackgroundColor,
modalBarrierColor,
shadowColor,
modalElevation,
shape,
showDragHandle,
dragHandleColor,
dragHandleSize,
clipBehavior,
constraints,
);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
return other is BottomSheetThemeData
&& other.backgroundColor == backgroundColor
&& other.surfaceTintColor == surfaceTintColor
&& other.elevation == elevation
&& other.modalBackgroundColor == modalBackgroundColor
&& other.shadowColor == shadowColor
&& other.modalBarrierColor == modalBarrierColor
&& other.modalElevation == modalElevation
&& other.shape == shape
&& other.showDragHandle == showDragHandle
&& other.dragHandleColor == dragHandleColor
&& other.dragHandleSize == dragHandleSize
&& other.clipBehavior == clipBehavior
&& other.constraints == constraints;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(ColorProperty('backgroundColor', backgroundColor, defaultValue: null));
properties.add(ColorProperty('surfaceTintColor', surfaceTintColor, defaultValue: null));
properties.add(DoubleProperty('elevation', elevation, defaultValue: null));
properties.add(ColorProperty('modalBackgroundColor', modalBackgroundColor, defaultValue: null));
properties.add(ColorProperty('shadowColor', shadowColor, defaultValue: null));
properties.add(ColorProperty('modalBarrierColor', modalBarrierColor, defaultValue: null));
properties.add(DoubleProperty('modalElevation', modalElevation, defaultValue: null));
properties.add(DiagnosticsProperty<ShapeBorder>('shape', shape, defaultValue: null));
properties.add(DiagnosticsProperty<bool>('showDragHandle', showDragHandle, defaultValue: null));
properties.add(ColorProperty('dragHandleColor', dragHandleColor, defaultValue: null));
properties.add(DiagnosticsProperty<Size>('dragHandleSize', dragHandleSize, defaultValue: null));
properties.add(DiagnosticsProperty<Clip>('clipBehavior', clipBehavior, defaultValue: null));
properties.add(DiagnosticsProperty<BoxConstraints>('constraints', constraints, defaultValue: null));
}
}
| flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart",
"repo_id": "flutter",
"token_count": 2830
} | 797 |
// 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/widgets.dart';
import 'constants.dart';
import 'theme.dart';
// Examples can assume:
// late String userAvatarUrl;
/// A circle that represents a user.
///
/// Typically used with a user's profile image, or, in the absence of
/// such an image, the user's initials. A given user's initials should
/// always be paired with the same background color, for consistency.
///
/// If [foregroundImage] fails then [backgroundImage] is used. If
/// [backgroundImage] fails too, [backgroundColor] is used.
///
/// The [onBackgroundImageError] parameter must be null if the [backgroundImage]
/// is null.
/// The [onForegroundImageError] parameter must be null if the [foregroundImage]
/// is null.
///
/// {@tool snippet}
///
/// If the avatar is to have an image, the image should be specified in the
/// [backgroundImage] property:
///
/// ```dart
/// CircleAvatar(
/// backgroundImage: NetworkImage(userAvatarUrl),
/// )
/// ```
/// {@end-tool}
///
/// The image will be cropped to have a circle shape.
///
/// {@tool snippet}
///
/// If the avatar is to just have the user's initials, they are typically
/// provided using a [Text] widget as the [child] and a [backgroundColor]:
///
/// ```dart
/// CircleAvatar(
/// backgroundColor: Colors.brown.shade800,
/// child: const Text('AH'),
/// )
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [Chip], for representing users or concepts in long form.
/// * [ListTile], which can combine an icon (such as a [CircleAvatar]) with
/// some text for a fixed height list entry.
/// * <https://material.io/design/components/chips.html#input-chips>
class CircleAvatar extends StatelessWidget {
/// Creates a circle that represents a user.
const CircleAvatar({
super.key,
this.child,
this.backgroundColor,
this.backgroundImage,
this.foregroundImage,
this.onBackgroundImageError,
this.onForegroundImageError,
this.foregroundColor,
this.radius,
this.minRadius,
this.maxRadius,
}) : assert(radius == null || (minRadius == null && maxRadius == null)),
assert(backgroundImage != null || onBackgroundImageError == null),
assert(foregroundImage != null || onForegroundImageError== null);
/// The widget below this widget in the tree.
///
/// Typically a [Text] widget. If the [CircleAvatar] is to have an image, use
/// [backgroundImage] instead.
final Widget? child;
/// The color with which to fill the circle. Changing the background
/// color will cause the avatar to animate to the new color.
///
/// If a [backgroundColor] is not specified and [ThemeData.useMaterial3] is true,
/// [ColorScheme.primaryContainer] will be used, otherwise the theme's
/// [ThemeData.primaryColorLight] is used with dark foreground colors, and
/// [ThemeData.primaryColorDark] with light foreground colors.
final Color? backgroundColor;
/// The default text color for text in the circle.
///
/// Defaults to the primary text theme color if no [backgroundColor] is
/// specified.
///
/// If a [foregroundColor] is not specified and [ThemeData.useMaterial3] is true,
/// [ColorScheme.onPrimaryContainer] will be used, otherwise the theme's
/// [ThemeData.primaryColorLight] for dark background colors, and
/// [ThemeData.primaryColorDark] for light background colors.
final Color? foregroundColor;
/// The background image of the circle. Changing the background
/// image will cause the avatar to animate to the new image.
///
/// Typically used as a fallback image for [foregroundImage].
///
/// If the [CircleAvatar] is to have the user's initials, use [child] instead.
final ImageProvider? backgroundImage;
/// The foreground image of the circle.
///
/// Typically used as profile image. For fallback use [backgroundImage].
final ImageProvider? foregroundImage;
/// An optional error callback for errors emitted when loading
/// [backgroundImage].
final ImageErrorListener? onBackgroundImageError;
/// An optional error callback for errors emitted when loading
/// [foregroundImage].
final ImageErrorListener? onForegroundImageError;
/// The size of the avatar, expressed as the radius (half the diameter).
///
/// If [radius] is specified, then neither [minRadius] nor [maxRadius] may be
/// specified. Specifying [radius] is equivalent to specifying a [minRadius]
/// and [maxRadius], both with the value of [radius].
///
/// If neither [minRadius] nor [maxRadius] are specified, defaults to 20
/// logical pixels. This is the appropriate size for use with
/// [ListTile.leading].
///
/// Changes to the [radius] are animated (including changing from an explicit
/// [radius] to a [minRadius]/[maxRadius] pair or vice versa).
final double? radius;
/// The minimum size of the avatar, expressed as the radius (half the
/// diameter).
///
/// If [minRadius] is specified, then [radius] must not also be specified.
///
/// Defaults to zero.
///
/// Constraint changes are animated, but size changes due to the environment
/// itself changing are not. For example, changing the [minRadius] from 10 to
/// 20 when the [CircleAvatar] is in an unconstrained environment will cause
/// the avatar to animate from a 20 pixel diameter to a 40 pixel diameter.
/// However, if the [minRadius] is 40 and the [CircleAvatar] has a parent
/// [SizedBox] whose size changes instantaneously from 20 pixels to 40 pixels,
/// the size will snap to 40 pixels instantly.
final double? minRadius;
/// The maximum size of the avatar, expressed as the radius (half the
/// diameter).
///
/// If [maxRadius] is specified, then [radius] must not also be specified.
///
/// Defaults to [double.infinity].
///
/// Constraint changes are animated, but size changes due to the environment
/// itself changing are not. For example, changing the [maxRadius] from 10 to
/// 20 when the [CircleAvatar] is in an unconstrained environment will cause
/// the avatar to animate from a 20 pixel diameter to a 40 pixel diameter.
/// However, if the [maxRadius] is 40 and the [CircleAvatar] has a parent
/// [SizedBox] whose size changes instantaneously from 20 pixels to 40 pixels,
/// the size will snap to 40 pixels instantly.
final double? maxRadius;
// The default radius if nothing is specified.
static const double _defaultRadius = 20.0;
// The default min if only the max is specified.
static const double _defaultMinRadius = 0.0;
// The default max if only the min is specified.
static const double _defaultMaxRadius = double.infinity;
double get _minDiameter {
if (radius == null && minRadius == null && maxRadius == null) {
return _defaultRadius * 2.0;
}
return 2.0 * (radius ?? minRadius ?? _defaultMinRadius);
}
double get _maxDiameter {
if (radius == null && minRadius == null && maxRadius == null) {
return _defaultRadius * 2.0;
}
return 2.0 * (radius ?? maxRadius ?? _defaultMaxRadius);
}
@override
Widget build(BuildContext context) {
assert(debugCheckHasMediaQuery(context));
final ThemeData theme = Theme.of(context);
final Color? effectiveForegroundColor = foregroundColor
?? (theme.useMaterial3 ? theme.colorScheme.onPrimaryContainer : null);
final TextStyle effectiveTextStyle = theme.useMaterial3
? theme.textTheme.titleMedium!
: theme.primaryTextTheme.titleMedium!;
TextStyle textStyle = effectiveTextStyle.copyWith(color: effectiveForegroundColor);
Color? effectiveBackgroundColor = backgroundColor
?? (theme.useMaterial3 ? theme.colorScheme.primaryContainer : null);
if (effectiveBackgroundColor == null) {
effectiveBackgroundColor = switch (ThemeData.estimateBrightnessForColor(textStyle.color!)) {
Brightness.dark => theme.primaryColorLight,
Brightness.light => theme.primaryColorDark,
};
} else if (effectiveForegroundColor == null) {
textStyle = switch (ThemeData.estimateBrightnessForColor(backgroundColor!)) {
Brightness.dark => textStyle.copyWith(color: theme.primaryColorLight),
Brightness.light => textStyle.copyWith(color: theme.primaryColorDark),
};
}
final double minDiameter = _minDiameter;
final double maxDiameter = _maxDiameter;
return AnimatedContainer(
constraints: BoxConstraints(
minHeight: minDiameter,
minWidth: minDiameter,
maxWidth: maxDiameter,
maxHeight: maxDiameter,
),
duration: kThemeChangeDuration,
decoration: BoxDecoration(
color: effectiveBackgroundColor,
image: backgroundImage != null
? DecorationImage(
image: backgroundImage!,
onError: onBackgroundImageError,
fit: BoxFit.cover,
)
: null,
shape: BoxShape.circle,
),
foregroundDecoration: foregroundImage != null
? BoxDecoration(
image: DecorationImage(
image: foregroundImage!,
onError: onForegroundImageError,
fit: BoxFit.cover,
),
shape: BoxShape.circle,
)
: null,
child: child == null
? null
: Center(
// Need to disable text scaling here so that the text doesn't
// escape the avatar when the textScaleFactor is large.
child: MediaQuery.withNoTextScaling(
child: IconTheme(
data: theme.iconTheme.copyWith(color: textStyle.color),
child: DefaultTextStyle(
style: textStyle,
child: child!,
),
),
),
),
);
}
}
| flutter/packages/flutter/lib/src/material/circle_avatar.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/material/circle_avatar.dart",
"repo_id": "flutter",
"token_count": 3233
} | 798 |
// 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 'dart:ui' show lerpDouble;
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'theme.dart';
/// Defines a theme for [Dialog] widgets.
///
/// Descendant widgets obtain the current [DialogTheme] object using
/// `DialogTheme.of(context)`. Instances of [DialogTheme] can be customized with
/// [DialogTheme.copyWith].
///
/// [titleTextStyle] and [contentTextStyle] are used in [AlertDialog]s and [SimpleDialog]s.
///
/// See also:
///
/// * [Dialog], a dialog that can be customized using this [DialogTheme].
/// * [AlertDialog], a dialog that can be customized using this [DialogTheme].
/// * [SimpleDialog], a dialog that can be customized using this [DialogTheme].
/// * [ThemeData], which describes the overall theme information for the
/// application.
@immutable
class DialogTheme with Diagnosticable {
/// Creates a dialog theme that can be used for [ThemeData.dialogTheme].
const DialogTheme({
this.backgroundColor,
this.elevation,
this.shadowColor,
this.surfaceTintColor,
this.shape,
this.alignment,
this.iconColor,
this.titleTextStyle,
this.contentTextStyle,
this.actionsPadding,
this.barrierColor,
this.insetPadding,
});
/// Overrides the default value for [Dialog.backgroundColor].
final Color? backgroundColor;
/// Overrides the default value for [Dialog.elevation].
final double? elevation;
/// Overrides the default value for [Dialog.shadowColor].
final Color? shadowColor;
/// Overrides the default value for [Dialog.surfaceTintColor].
final Color? surfaceTintColor;
/// Overrides the default value for [Dialog.shape].
final ShapeBorder? shape;
/// Overrides the default value for [Dialog.alignment].
final AlignmentGeometry? alignment;
/// Overrides the default value for [DefaultTextStyle] for [SimpleDialog.title] and
/// [AlertDialog.title].
final TextStyle? titleTextStyle;
/// Overrides the default value for [DefaultTextStyle] for [SimpleDialog.children] and
/// [AlertDialog.content].
final TextStyle? contentTextStyle;
/// Overrides the default value for [AlertDialog.actionsPadding].
final EdgeInsetsGeometry? actionsPadding;
/// Used to configure the [IconTheme] for the [AlertDialog.icon] widget.
final Color? iconColor;
/// Overrides the default value for [barrierColor] in [showDialog].
final Color? barrierColor;
/// Overrides the default value for [Dialog.insetPadding].
final EdgeInsets? insetPadding;
/// Creates a copy of this object but with the given fields replaced with the
/// new values.
DialogTheme copyWith({
Color? backgroundColor,
double? elevation,
Color? shadowColor,
Color? surfaceTintColor,
ShapeBorder? shape,
AlignmentGeometry? alignment,
Color? iconColor,
TextStyle? titleTextStyle,
TextStyle? contentTextStyle,
EdgeInsetsGeometry? actionsPadding,
Color? barrierColor,
EdgeInsets? insetPadding,
}) {
return DialogTheme(
backgroundColor: backgroundColor ?? this.backgroundColor,
elevation: elevation ?? this.elevation,
shadowColor: shadowColor ?? this.shadowColor,
surfaceTintColor: surfaceTintColor ?? this.surfaceTintColor,
shape: shape ?? this.shape,
alignment: alignment ?? this.alignment,
iconColor: iconColor ?? this.iconColor,
titleTextStyle: titleTextStyle ?? this.titleTextStyle,
contentTextStyle: contentTextStyle ?? this.contentTextStyle,
actionsPadding: actionsPadding ?? this.actionsPadding,
barrierColor: barrierColor ?? this.barrierColor,
insetPadding: insetPadding ?? this.insetPadding,
);
}
/// The data from the closest [DialogTheme] instance given the build context.
static DialogTheme of(BuildContext context) {
return Theme.of(context).dialogTheme;
}
/// Linearly interpolate between two dialog themes.
///
/// {@macro dart.ui.shadow.lerp}
static DialogTheme lerp(DialogTheme? a, DialogTheme? b, double t) {
if (identical(a, b) && a != null) {
return a;
}
return DialogTheme(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
elevation: lerpDouble(a?.elevation, b?.elevation, t),
shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
surfaceTintColor: Color.lerp(a?.surfaceTintColor, b?.surfaceTintColor, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
alignment: AlignmentGeometry.lerp(a?.alignment, b?.alignment, t),
iconColor: Color.lerp(a?.iconColor, b?.iconColor, t),
titleTextStyle: TextStyle.lerp(a?.titleTextStyle, b?.titleTextStyle, t),
contentTextStyle: TextStyle.lerp(a?.contentTextStyle, b?.contentTextStyle, t),
actionsPadding: EdgeInsetsGeometry.lerp(a?.actionsPadding, b?.actionsPadding, t),
barrierColor: Color.lerp(a?.barrierColor, b?.barrierColor, t),
insetPadding: EdgeInsets.lerp(a?.insetPadding, b?.insetPadding, t),
);
}
@override
int get hashCode => Object.hashAll(<Object?>[
backgroundColor,
elevation,
shadowColor,
surfaceTintColor,
shape,
alignment,
iconColor,
titleTextStyle,
contentTextStyle,
actionsPadding,
barrierColor,
insetPadding,
]);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (other.runtimeType != runtimeType) {
return false;
}
return other is DialogTheme
&& other.backgroundColor == backgroundColor
&& other.elevation == elevation
&& other.shadowColor == shadowColor
&& other.surfaceTintColor == surfaceTintColor
&& other.shape == shape
&& other.alignment == alignment
&& other.iconColor == iconColor
&& other.titleTextStyle == titleTextStyle
&& other.contentTextStyle == contentTextStyle
&& other.actionsPadding == actionsPadding
&& other.barrierColor == barrierColor
&& other.insetPadding == insetPadding;
}
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(ColorProperty('backgroundColor', backgroundColor));
properties.add(DoubleProperty('elevation', elevation));
properties.add(ColorProperty('shadowColor', shadowColor));
properties.add(ColorProperty('surfaceTintColor', surfaceTintColor));
properties.add(DiagnosticsProperty<ShapeBorder>('shape', shape, defaultValue: null));
properties.add(DiagnosticsProperty<AlignmentGeometry>('alignment', alignment, defaultValue: null));
properties.add(ColorProperty('iconColor', iconColor));
properties.add(DiagnosticsProperty<TextStyle>('titleTextStyle', titleTextStyle, defaultValue: null));
properties.add(DiagnosticsProperty<TextStyle>('contentTextStyle', contentTextStyle, defaultValue: null));
properties.add(DiagnosticsProperty<EdgeInsetsGeometry>('actionsPadding', actionsPadding, defaultValue: null));
properties.add(ColorProperty('barrierColor', barrierColor));
properties.add(DiagnosticsProperty<EdgeInsets>('insetPadding', insetPadding, defaultValue: null));
}
}
| flutter/packages/flutter/lib/src/material/dialog_theme.dart/0 | {
"file_path": "flutter/packages/flutter/lib/src/material/dialog_theme.dart",
"repo_id": "flutter",
"token_count": 2438
} | 799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.