Answers for "appbar flutter"

1

flutter create custom appbar

// ./components/appBar.dart
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( // your customization here
      title: Text('$_title'),
      centerTitle: true,
      backgroundColor: Colors.black54,
    );
  }
}

// on the file using the appBar just: 

import 'package:flutter/material.dart';
import 'package:photo_app/components/appBar.dart';

class Albums extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar('Your title here'),
    );
  }
}
Posted by: Guest on August-30-2020
0

appbar theme flutter

appBarTheme: AppBarTheme().copyWith(
          textTheme: TextTheme(
            headline6: TextStyle(
              fontFamily: 'Open Sans',
              fontWeight: FontWeight.bold,
              fontSize: 20,
            ),
          ),
        ),
Posted by: Guest on March-15-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language