how to align the AppBar title to right in flutter?

Viewed 41
import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          toolbarHeight: 50.0,          
          title: const Text(
            'This is the title !',
            style: TextStyle(color: Colors.black),
          ),
          backgroundColor: Colors.amber,
        ),
      ),
    ));
4 Answers

Wrap your title in a Align and apply Alignment.centerRight to it

Scaffold(
      appBar: AppBar(
        title: Align(
          alignment: Alignment.centerRight,
          child: Text(
            "My title",
            
          ),
        ),
  return Scaffold(
        appBar: AppBar(
        title: Align(
        alignment: Alignment.centerRight,
        child: Text(
        "title",

    ),),),
      body: getText("text"),
    );

enter image description here

put the title in actions rather than the title or leading to add it to the left

Set alignment : right then the problem will be solved . Those javascript frameworks work just like others.

Related