Skip to content

Instantly share code, notes, and snippets.

@hnoor
Last active September 6, 2022 20:35
Show Gist options
  • Select an option

  • Save hnoor/10c83b18a5997886fc1dcf015cfe6796 to your computer and use it in GitHub Desktop.

Select an option

Save hnoor/10c83b18a5997886fc1dcf015cfe6796 to your computer and use it in GitHub Desktop.

Revisions

  1. hnoor revised this gist Jun 20, 2020. 1 changed file with 0 additions and 28 deletions.
    28 changes: 0 additions & 28 deletions custom_app_bar2.dart
    Original file line number Diff line number Diff line change
    @@ -1,28 +0,0 @@
    import 'package:flutter/material.dart';

    class CustomAppBar extends StatelessWidget {
    final String title;
    const CustomAppBar(
    this.title, {
    Key key,
    }) : super(key: key);
    @override
    Widget build(BuildContext context) {
    MediaQueryData mediaQuery = MediaQuery.of(context);
    double height =
    (mediaQuery.size.height - mediaQuery.padding.top) * HEADER_HEIGHT;
    return Container(
    height: height,
    child: Row(
    children: <Widget>[
    IconButton(
    color: Colors.black,
    icon: Icon(Icons.chevron_left),
    onPressed: () => Navigator.pop(context),
    ),
    Text(title)
    ],
    ),
    );
    }
    }
  2. hnoor revised this gist Jun 20, 2020. 1 changed file with 28 additions and 0 deletions.
    28 changes: 28 additions & 0 deletions custom_app_bar2.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    import 'package:flutter/material.dart';

    class CustomAppBar extends StatelessWidget {
    final String title;
    const CustomAppBar(
    this.title, {
    Key key,
    }) : super(key: key);
    @override
    Widget build(BuildContext context) {
    MediaQueryData mediaQuery = MediaQuery.of(context);
    double height =
    (mediaQuery.size.height - mediaQuery.padding.top) * HEADER_HEIGHT;
    return Container(
    height: height,
    child: Row(
    children: <Widget>[
    IconButton(
    color: Colors.black,
    icon: Icon(Icons.chevron_left),
    onPressed: () => Navigator.pop(context),
    ),
    Text(title)
    ],
    ),
    );
    }
    }
  3. hnoor created this gist Jun 20, 2020.
    30 changes: 30 additions & 0 deletions custom_app_bar.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    import 'package:flutter/material.dart';

    class CustomAppBar extends StatelessWidget with PreferredSizeWidget {
    final String title;

    @override
    final Size preferredSize;

    CustomAppBar(
    this.title, {
    Key key,
    }) : preferredSize = Size.fromHeight(50.0),
    super(key: key);

    @override
    Widget build(BuildContext context) {
    return AppBar(
    title: Text(
    title,
    style: TextStyle(color: Colors.black),
    ),
    backgroundColor: Colors.white,
    leading: IconButton(
    icon: Icon(Icons.chevron_left),
    onPressed: () => Navigator.pop(context),
    color: Colors.black,
    ),
    );
    }
    }