Flutter Tutorials

Flutter app development tutorials


flutter – SizedBox full width

main.dart


import 'package:flutter/material.dart';

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

bodyContent(){
  return Padding(
      padding: const EdgeInsets.all(12),
      child: SizedBox(
          width: double.infinity,
          height: 125,
          child: ElevatedButton(
              onPressed: (){},
              child: const Text("Click Me")
          )
      )
  );
}

More flutter tutorials



About Me

Flutter Developer

Design a site like this with WordPress.com
Get started