modal_bottom_sheet_demo.dart 1.3 KB
Newer Older
1 2 3 4 5 6
// Copyright 2015 The Chromium 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/material.dart';

7 8
import '../../gallery/demo.dart';

9
class ModalBottomSheetDemo extends StatelessWidget {
10
  static const String routeName = '/material/modal-bottom-sheet';
11

12
  @override
13
  Widget build(BuildContext context) {
14
    return Scaffold(
15 16 17 18
      appBar: AppBar(
        title: const Text('Modal bottom sheet'),
        actions: <Widget>[MaterialDemoDocumentationButton(routeName)],
      ),
19 20
      body: Center(
        child: RaisedButton(
21
          child: const Text('SHOW BOTTOM SHEET'),
22
          onPressed: () {
23
            showModalBottomSheet<void>(context: context, builder: (BuildContext context) {
24 25
              return Container(
                child: Padding(
26
                  padding: const EdgeInsets.all(32.0),
27
                  child: Text('This is the modal bottom sheet. Tap anywhere to dismiss.',
28
                    textAlign: TextAlign.center,
29
                    style: TextStyle(
30 31 32
                      color: Theme.of(context).accentColor,
                      fontSize: 24.0
                    )
33
                  )
34 35 36 37
                )
              );
            });
          }
38 39 40 41 42
        )
      )
    );
  }
}