animated_icons_data.dart 3.29 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6 7 8 9 10 11 12
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// This file serves as the interface between the public and private APIs for
// animated icons.
// The AnimatedIcons class is public and is used to specify available icons,
// while the _AnimatedIconData interface which used to deliver the icon data is
// kept private.

part of material_animated_icons;

13
/// Identifier for the supported Material Design animated icons.
14 15 16
///
/// Use with [AnimatedIcon] class to show specific animated icons.
abstract class AnimatedIcons {
17

18
  /// The Material Design add to event icon animation.
19 20
  static const AnimatedIconData add_event = _$add_event;

21
  /// The Material Design arrow to menu icon animation.
22 23
  static const AnimatedIconData arrow_menu = _$arrow_menu;

24
  /// The Material Design close to menu icon animation.
25 26
  static const AnimatedIconData close_menu = _$close_menu;

27
  /// The Material Design ellipsis to search icon animation.
28 29
  static const AnimatedIconData ellipsis_search = _$ellipsis_search;

30
  /// The Material Design event to add icon animation.
31 32
  static const AnimatedIconData event_add = _$event_add;

33
  /// The Material Design home to menu icon animation.
34 35
  static const AnimatedIconData home_menu = _$home_menu;

36
  /// The Material Design list to view icon animation.
37 38
  static const AnimatedIconData list_view = _$list_view;

39
  /// The Material Design menu to arrow icon animation.
40
  static const AnimatedIconData menu_arrow = _$menu_arrow;
41

42
  /// The Material Design menu to close icon animation.
43 44
  static const AnimatedIconData menu_close = _$menu_close;

45
  /// The Material Design menu to home icon animation.
46 47
  static const AnimatedIconData menu_home = _$menu_home;

48
  /// The Material Design pause to play icon animation.
49 50
  static const AnimatedIconData pause_play = _$pause_play;

51
  /// The Material Design play to pause icon animation.
52 53
  static const AnimatedIconData play_pause = _$play_pause;

54
  /// The Material Design search to ellipsis icon animation.
55 56
  static const AnimatedIconData search_ellipsis = _$search_ellipsis;

57
  /// The Material Design view to list icon animation.
58
  static const AnimatedIconData view_list = _$view_list;
59 60 61 62 63 64 65 66
}

/// Vector graphics data for icons used by [AnimatedIcon].
///
/// Instances of this class are currently opaque because we have not committed to a specific
/// animated vector graphics format.
///
/// See also:
67
///
68 69 70 71 72
///  * [AnimatedIcons], a class that contains constants that implement this interface.
abstract class AnimatedIconData {
  /// Abstract const constructor. This constructor enables subclasses to provide
  /// const constructors so that they can be used in const expressions.
  const AnimatedIconData();
73

74 75 76 77
  /// Whether this icon should be mirrored horizontally when text direction is
  /// right-to-left.
  ///
  /// See also:
78
  ///
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
  ///  * [TextDirection], which discusses concerns regarding reading direction
  ///    in Flutter.
  ///  * [Directionality], a widget which determines the ambient directionality.
  bool get matchTextDirection;
}

class _AnimatedIconData extends AnimatedIconData {
  const _AnimatedIconData(this.size, this.paths, {this.matchTextDirection = false});

  final Size size;
  final List<_PathFrames> paths;

  @override
  final bool matchTextDirection;
}