modal_bottom_sheet_demo.dart 1.21 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
class ModalBottomSheetDemo extends StatelessWidget {
8
  static const String routeName = '/material/modal-bottom-sheet';
9

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