• Ian Hickson's avatar
    License update (#45373) · 449f4a66
    Ian Hickson authored
    * Update project.pbxproj files to say Flutter rather than Chromium
    
    Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.
    
    * Update the copyright notice checker to require a standard notice on all files
    
    * Update copyrights on Dart files. (This was a mechanical commit.)
    
    * Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.
    
    Some were already marked "The Flutter Authors", not clear why. Their
    dates have been normalized. Some were missing the blank line after the
    license. Some were randomly different in trivial ways for no apparent
    reason (e.g. missing the trailing period).
    
    * Clean up the copyrights in non-Dart files. (Manual edits.)
    
    Also, make sure templates don't have copyrights.
    
    * Fix some more ORGANIZATIONNAMEs
    Unverified
    449f4a66
spacer.dart 2.14 KB
// 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/rendering.dart';

import 'basic.dart';
import 'framework.dart';

/// Spacer creates an adjustable, empty spacer that can be used to tune the
/// spacing between widgets in a [Flex] container, like [Row] or [Column].
///
/// The [Spacer] widget will take up any available space, so setting the
/// [Flex.mainAxisAlignment] on a flex container that contains a [Spacer] to
/// [MainAxisAlignment.spaceAround], [MainAxisAlignment.spaceBetween], or
/// [MainAxisAlignment.spaceEvenly] will not have any visible effect: the
/// [Spacer] has taken up all of the additional space, therefore there is none
/// left to redistribute.
///
/// {@tool sample}
///
/// ```dart
/// Row(
///   children: <Widget>[
///     Text('Begin'),
///     Spacer(), // Defaults to a flex of one.
///     Text('Middle'),
///     // Gives twice the space between Middle and End than Begin and Middle.
///     Spacer(flex: 2),
///     Text('End'),
///   ],
/// )
/// ```
/// {@end-tool}
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=7FJgd7QN1zI}
///
/// See also:
///
///  * [Row] and [Column], which are the most common containers to use a Spacer
///    in.
///  * [SizedBox], to create a box with a specific size and an optional child.
class Spacer extends StatelessWidget {
  /// Creates a flexible space to insert into a [Flexible] widget.
  ///
  /// The [flex] parameter may not be null or less than one.
  const Spacer({Key key, this.flex = 1})
    : assert(flex != null),
      assert(flex > 0),
      super(key: key);

  /// The flex factor to use in determining how much space to take up.
  ///
  /// The amount of space the [Spacer] can occupy in the main axis is determined
  /// by dividing the free space proportionately, after placing the inflexible
  /// children, according to the flex factors of the flexible children.
  ///
  /// Defaults to one.
  final int flex;

  @override
  Widget build(BuildContext context) {
    return Expanded(
      flex: flex,
      child: const SizedBox.shrink(),
    );
  }
}