flutterflutter-appbar

How To Place AppBar Title in Left Side in Flutter


Here is my code for AppBar Tittle, but it not Working

 Widget build(BuildContext context){
return new Scaffold(
  appBar: new AppBar(
    title: new Padding(
      padding: const EdgeInsets.only(left: 20.0),
      child: new Text("App Name"),
    ),
  ),
);}

Solution

  • Transform is the widget used for forcefully translating widgets in the x-y-z dimensions.

    return Scaffold(
            appBar: AppBar(
              centerTitle: false,
              titleSpacing: 0.0,
              title:  Transform(
                  // you can forcefully translate values left side using Transform
                  transform:  Matrix4.translationValues(-20.0, 0.0, 0.0),
                  child: Text(
                    "HOLIDAYS",
                    style: TextStyle(
                      color: dateBackgroundColor,
                    ),
                  ),
                ),
            ),
          );