Skip to content

SafeArea should have a fab parameter #30105

@Zazo032

Description

@Zazo032

Steps to Reproduce

When using a SafeArea, there should be an option to place the FloatingActionButton inside the device's SafeArea, but also extend its body to the bottom of the screen (using bottom: false and fab: true, for example).

Images

Sample code:

import 'package:flutter/material.dart';

void main() {
  runApp(
    MaterialApp(
      title: "Swapp",
      home: SafeAreaExtended(),
    ),
  );
}

class SafeAreaExtended extends StatelessWidget {
  final List<String> sampleData =
      List.generate(50, (index) => 'Item $index', growable: false);
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        floatingActionButton: FloatingActionButton.extended(
          onPressed: () => null,
          label: Text('Add'),
          icon: Icon(Icons.add),
        ),
        body: ListView.builder(
          itemCount: sampleData.length,
          itemBuilder: (context, index) => Text(sampleData[index]),
        ),
      ),
    );
  }
}

Logs

$ flutter doctor -v
[✓] Flutter (Channel master, v1.4.5-pre.12, on Mac OS X 10.14.4 18E226, locale es-ES)
    • Flutter version 1.4.5-pre.12 at /Applications/flutter
    • Framework revision 557c94ff77 (4 hours ago), 2019-03-28 01:00:29 -0700
    • Engine revision 37947f961a
    • Dart version 2.2.1 (build 2.2.1-dev.2.0 None)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/cristianzazo/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2, Build version 10E125
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.0.beta.2

[✓] Android Studio
    • Android Studio at /Applications/Android Studio 3.4 Preview.app/Contents
    • Flutter plugin version 32.0.2
    • Dart plugin version 183.4733
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.4.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.found in release: 1.19Found to occur in 1.19frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions