Вы можете использовать gradient
внутри Container
виджета
Вот полный код:
import 'package:flutter/material.dart';
class ClassName extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[200],
//You can add Appbar like this
appBar: AppBar(
backgroundColor: Colors.white,
centerTitle: true,
title: Text('This is appbar', style: TextStyle(color: Colors.black, fontSize: 18.0),),
),
body: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.all(10.0),
child: Column(
children: [
//You can add other Widgets here
Container(
child: GestureDetector(
onTap: (){
//add functions of this button here
},
child: Container(
height: 50.0,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [Colors.red[100], Colors.red[900]],
),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: Center(
child: Text('Login', style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 18.0),),
),
),
)
),
//You can add other Widgets here
],
),
),
),
);
}
Вот скриншот:
Скриншот
Думаю, это именно то, о чем вы просите.
И дайте мне знать, если понадобится другая помощь.