How do I create a Flatbutton in flutter with 2 colors? not gradient, 2 solid color side by side.
Try this code. You can tweak it to meet your needs
class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return FlatButton( onPressed: () {}, child: Container( height: 50, width: 100, child: Stack( children: [ Row( children: [ Expanded(child: Container(color: Colors.red)), Expanded(child: Container(color: Colors.blue)), ], ), Center(child: Text('PRESS ME')), ], ), ), ); } }
might be a shorter answer using gradient and stops
decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.red, Theme.of(context).buttonColor] stops: [0.5, 0.5] ), borderRadius: BorderRadius.circular(10.0), ),
Copyright © 2021 Jogjafile Inc.
Try this code. You can tweak it to meet your needs