TopBar function

AppBar TopBar({
  1. required Color background_color,
  2. required List<Widget> actions,
  3. required bool has_back_button,
  4. required Widget? custom_leading,
  5. String? logo_path,
  6. Color? logo_color,
})

Implementation

AppBar TopBar({
  required Color background_color,
  required List<Widget> actions,
  required bool has_back_button,
  required Widget? custom_leading,
  String? logo_path,
  Color? logo_color,
}) {
  double topbar_height = 65;
  return AppBar(
    leading: !has_back_button ? Container() : custom_leading,
    centerTitle: false,
    title: logo_path != null && logo_path.isNotEmpty
        ? logo_path.contains("https")
            ? Container(
                height: topbar_height,
                width: topbar_height,
                child: Webview(
                  src: logo_path,
                  id: Uuid().v4(),
                ),
              )
            : Image.asset(
                logo_path,
                height: topbar_height,
                width: topbar_height,
                color: logo_color,
              )
        : Container(),
    backgroundColor: background_color,
    elevation: 0,
    actions: actions,
  );
}