CopyPastor

Detecting plagiarism made easy.

Score: 0.8658792027960653; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-08-23
by Mansoor Malik

Original Post

Original - Posted on 2019-06-10
by ck\_12



            
Present in both answers; Present only in the new answer; Present only in the old answer;

This is another way of going about it. By doing this you can customize this appbar to the way you want. That way, if you continue with that style, you don't have to recreate it on every page. You create it once and call on it within any widget.
**Class**
import 'package:flutter/material.dart'; class BaseAppBar extends StatelessWidget implements PreferredSizeWidget { final Color backgroundColor = Colors.red; final Text title; final AppBar appBar; final List<Widget> widgets; /// you can add more fields that meet your needs const BaseAppBar({Key key, this.title, this.appBar, this.widgets}) : super(key: key); @override Widget build(BuildContext context) { return AppBar( title: title, backgroundColor: backgroundColor, actions: widgets, ); } @override Size get preferredSize => new Size.fromHeight(appBar.preferredSize.height); }
**Implementation** within desired page
@override Widget build(BuildContext context) { return Scaffold( appBar: BaseAppBar( title: Text('title'), appBar: AppBar(), widgets: <Widget>[Icon(Icons.more_vert)], ), body: Container()); }
This is another way of going about it. By doing this you can customize this appbar to the way you want. That way, if you continue with that style, you don't have to recreate it on every page. You create it once and call on it within any widget.
**Class** ``` import 'package:flutter/material.dart';
class BaseAppBar extends StatelessWidget implements PreferredSizeWidget { final Color backgroundColor = Colors.red; final Text title; final AppBar appBar; final List<Widget> widgets;
/// you can add more fields that meet your needs
const BaseAppBar({Key key, this.title, this.appBar, this.widgets}) : super(key: key);
@override Widget build(BuildContext context) { return AppBar( title: title, backgroundColor: backgroundColor, actions: widgets, ); }
@override Size get preferredSize => new Size.fromHeight(appBar.preferredSize.height); }
```
**Implementation** within desired page
``` @override Widget build(BuildContext context) { return Scaffold( appBar: BaseAppBar( title: Text('title'), appBar: AppBar(), widgets: <Widget>[Icon(Icons.more_vert)], ), body: Container()); } ```

        
Present in both answers; Present only in the new answer; Present only in the old answer;