"Fossies" - the Fresh Open Source Software Archive

Member "flutter-1.22.4/packages/flutter/lib/src/material/flutter_logo.dart" (13 Nov 2020, 2605 Bytes) of package /linux/misc/flutter-1.22.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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