how can I achieve buttons like these in flutter? I want these buttons to be sticked to the side and floated in the screen, just like bottom-navigation but to the side not to the buttom. I hope you all get the idea.
2
stick to those steps:
ElevatedButton
Scaffold
Stack
alignment: Alignment.center
children
Postioned
left
Positioned
left: 0,
Transform.rotate
angle
pi
dart:math
you could use RotatedBox widget something like the following:
class NewButton extends StatelessWidget { const NewButton({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("App Today")), body: Column( children: [ GestureDetector( onTap: () {}, child: Container( width: 40, height: 100, decoration: BoxDecoration( color: Color.fromARGB(255, 54, 105, 247), borderRadius: BorderRadius.horizontal(right: Radius.circular(20)), border: Border.all( width: 2.0, color: Color.fromARGB(221, 8, 1, 24))), child: const RotatedBox( quarterTurns: 1, child: Text('REGISTER', style: TextStyle( fontSize: 18, color: Colors.white, ), textAlign: TextAlign.center)), ), ) ], ), ); } }
Click here to cancel reply.
2
Answers
stick to those steps:
ElevatedButton
Scaffold
with aStack
widgetStack
toalignment: Alignment.center
Stack
, the Scaffold should be a direct child in thechildren
property ofStack
at this point, make sure of thisElevatedButton
to thechildren
property as well, it should be a sibling of theScaffold
widgetElevatedButton
you created with aPostioned
widget.left
property ofPositioned
to 0,left: 0,
Transform.rotate
widget.angle
property topi
from thedart:math
build the library of dart.you could use RotatedBox widget something like the following: