Flutter Tutorials

Flutter app development tutorials


flutter – Button width match parent

main.dart


import 'package:flutter/material.dart';

void main() {
  runApp(
      MaterialApp(
          theme: ThemeData(primarySwatch: Colors.indigo),
          home: Scaffold(
              appBar: AppBar(
                  title: const Text("Flutter - Button Width Match Parent")
              ),
              body: bodyContent(),
              backgroundColor: Colors.indigo.shade50
          )
      )
  );
}

bodyContent(){
  return Padding(
      padding: const EdgeInsets.all(12),
      child: ElevatedButton(
          onPressed: (){},
          child: const Text("Click me"),
          style: ElevatedButton.styleFrom(
              fixedSize: const Size(double.maxFinite, 75)
          )
      )
  );
}

More flutter tutorials



About Me

Flutter Developer

Design a site like this with WordPress.com
Get started