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
new Scaffold(
appBar: AppBar(
title: Center(child: Text('Awesome AppBar')),
flexibleSpace: Container(
decoration: new BoxDecoration(
gradient: new LinearGradient(
colors: [
const Color(0xFF3366FF),
const Color(0xFF00CCFF),
],
begin: const FractionalOffset(0.0, 0.0),
end: const FractionalOffset(1.0, 0.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp),
),
),
),
body: ,
);
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(
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
<!DOCTYPE html>
<html>
<head>
<title>Background Gradient</title>
<style>
body {
background: linear-gradient(to right, #ff0000, #0000ff);
}
</style>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>