1// Copyright 2014 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5/// @docImport 'icon.dart';
6/// @docImport 'image_icon.dart';
7library;
8
9import 'basic.dart';
10import 'framework.dart';
11import 'icon_theme.dart';
12import 'icon_theme_data.dart';
13import 'implicit_animations.dart';
14
15/// The Flutter logo, in widget form. This widget respects the [IconTheme].
16/// For guidelines on using the Flutter logo, visit https://flutter.dev/brand.
17///
18/// {@youtube 560 315 https://www.youtube.com/watch?v=aAmP-WcI6dg}
19///
20/// See also:
21///
22/// * [IconTheme], which provides ambient configuration for icons.
23/// * [Icon], for showing icons the Material design icon library.
24/// * [ImageIcon], for showing icons from [AssetImage]s or other [ImageProvider]s.
25class FlutterLogo extends StatelessWidget {
26 /// Creates a widget that paints the Flutter logo.
27 ///
28 /// The [size] defaults to the value given by the current [IconTheme].
29 ///
30 /// The [textColor], [style], [duration], and [curve] arguments must not be
31 /// null.
32 const FlutterLogo({
33 super.key,
34 this.size,
35 this.textColor = const Color(0xFF757575),
36 this.style = FlutterLogoStyle.markOnly,
37 this.duration = const Duration(milliseconds: 750),
38 this.curve = Curves.fastOutSlowIn,
39 });
40
41 /// The size of the logo in logical pixels.
42 ///
43 /// The logo will be fit into a square this size.
44 ///
45 /// Defaults to the current [IconTheme] size, if any. If there is no
46 /// [IconTheme], or it does not specify an explicit size, then it defaults to
47 /// 24.0.
48 final double? size;
49
50 /// The color used to paint the "Flutter" text on the logo, if [style] is
51 /// [FlutterLogoStyle.horizontal] or [FlutterLogoStyle.stacked].
52 ///
53 /// If possible, the default (a medium grey) should be used against a white
54 /// background.
55 final Color textColor;
56
57 /// Whether and where to draw the "Flutter" text. By default, only the logo
58 /// itself is drawn.
59 final FlutterLogoStyle style;
60
61 /// The length of time for the animation if the [style] or [textColor]
62 /// properties are changed.
63 final Duration duration;
64
65 /// The curve for the logo animation if the [style] or [textColor] change.
66 final Curve curve;
67
68 @override
69 Widget build(BuildContext context) {
70 final IconThemeData iconTheme = IconTheme.of(context);
71 final double? iconSize = size ?? iconTheme.size;
72 return AnimatedContainer(
73 width: iconSize,
74 height: iconSize,
75 duration: duration,
76 curve: curve,
77 decoration: FlutterLogoDecoration(style: style, textColor: textColor),
78 );
79 }
80}
81