drawer_header.dart 1.54 KB
Newer Older
1 2 3 4
// 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.

5
import 'package:flutter/widgets.dart';
6

7
import 'constants.dart';
8
import 'debug.dart';
9
import 'theme.dart';
10 11 12 13

// TODO(jackson): This class should usually render the user's
// preferred banner image rather than a solid background

14
class DrawerHeader extends StatelessWidget {
15
  const DrawerHeader({ Key key, this.child }) : super(key: key);
16

17
  /// The widget below this widget in the tree.
18
  final Widget child;
19

20
  @override
21
  Widget build(BuildContext context) {
22
    assert(debugCheckHasMaterial(context));
23
    final double statusBarHeight = (MediaQuery.of(context)?.padding ?? EdgeInsets.zero).top;
24
    return new Container(
25
      height: statusBarHeight + kMaterialDrawerHeight,
26
      decoration: new BoxDecoration(
27
        backgroundColor: Theme.of(context).cardColor,
28 29 30 31 32 33 34
        border: const Border(
          bottom: const BorderSide(
            color: const Color(0xFFD1D9E1),
            width: 1.0
          )
        )
      ),
35 36
      padding: const EdgeInsets.only(bottom: 7.0),
      margin: const EdgeInsets.only(bottom: 8.0),
37 38 39 40
      child: new Column(
        children: <Widget>[
          new Flexible(child: new Container()),
          new Container(
41
            padding: const EdgeInsets.symmetric(horizontal: 16.0),
42
            child: new DefaultTextStyle(
43
              style: Theme.of(context).textTheme.body2,
44 45
              child: child
            )
46
          )
47
        ]
48 49 50 51
      )
    );
  }
}