Search code examples
flutterflutter-layout

Flutter : Why Text Widget on Flutter automatically centered when placed before TextField Widget ? ( Inside Column Widget )


So i tried to make my TextWidget aligned to left but when i put TextWidget above ( before ) TextFieldWidget it's automatically become centered following with the TextFieldWidget, here my code

import 'package:flutter/material.dart';

void main() {
  runApp(new MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Center(
            child: Text("SQLite Application"),
          ),
        ),
        body: Column(
          children: <Widget>[
            SizedBox(
              height: 20,
            ),
            Text("Name of Things"),
            TextField()
          ],
        ),
      ),
    );
  }
}

and here is the result : Code Output

Is there a solve to make the TextWidget to aligned to the left ? I've tried to use TextAlign.left on TextWidget but it wont change.


Solution

  • Use

    crossAxisAlignment: CrossAxisAlignment.start,
    

    on the Column