xxxxxxxxxx
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Testing',
home: new Scaffold(
//Here you can set what ever background color you need.
backgroundColor: Colors.white,
),
);
}
}
xxxxxxxxxx
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Gradient Background'),
),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xFF00FF00), Color(0xFF0000FF)], // Define the gradient colors
begin: Alignment.topLeft, // Define the gradient start point
end: Alignment.bottomRight, // Define the gradient end point
),
),
child: Center(
child: Text(
'Hello World',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
),
);
}
}
xxxxxxxxxx
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.green, // Setting the background color of the scaffold
appBar: AppBar(
title: Text('Flutter Scaffold Background Color'),
),
body: Center(
child: Text(
'Hello, World!',
style: TextStyle(fontSize: 24),
),
),
),
);
}
}
xxxxxxxxxx
MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(scaffoldBackgroundColor: const Color(0xFFEFEFEF)),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);