extract button styles

This commit is contained in:
Motia Benachour 2022-09-11 17:18:42 +01:00
parent 3baa33a838
commit 0637bd0d4d
No known key found for this signature in database
GPG key ID: 070D55D6C32CF425
4 changed files with 18 additions and 26 deletions

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:robo_advisory/utils/constants.dart'; import 'package:robo_advisory/utils/constants.dart';
import 'package:robo_advisory/config/Routes.dart'; import 'package:robo_advisory/config/Routes.dart';
import 'package:robo_advisory/widgets/buttons.dart';
class LoginScreen extends StatelessWidget { class LoginScreen extends StatelessWidget {
bool rememberSwitch = false; bool rememberSwitch = false;
@ -21,7 +22,7 @@ class LoginScreen extends StatelessWidget {
Expanded( Expanded(
child: Container( child: Container(
child: Center( child: Center(
child: TextButton( child: ElevatedButton(
onPressed: () { onPressed: () {
Navigator.pushNamed(context, Routes.register); Navigator.pushNamed(context, Routes.register);
}, },
@ -123,14 +124,7 @@ class LoginScreen extends StatelessWidget {
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: mainButtonStyle(),
padding: EdgeInsets.all(18.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
backgroundColor:Color(0xFF495057),
foregroundColor: Colors.white,
),
onPressed: () { onPressed: () {
Navigator.pushNamed(context, Routes.dashboard); Navigator.pushNamed(context, Routes.dashboard);
}, },

View file

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:pin_code_fields/pin_code_fields.dart'; import 'package:pin_code_fields/pin_code_fields.dart';
import 'package:robo_advisory/utils/constants.dart'; import 'package:robo_advisory/utils/constants.dart';
import 'package:robo_advisory/screens/register/register_step_2.dart'; import 'package:robo_advisory/screens/register/register_step_2.dart';
import 'package:robo_advisory/widgets/buttons.dart';
class RegisterFirstScreen extends StatelessWidget { class RegisterFirstScreen extends StatelessWidget {
@override @override
@ -90,15 +91,7 @@ class RegisterFirstScreen extends StatelessWidget {
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: mainButtonStyle(),
backgroundColor: Color(0xFF495057),
foregroundColor: Colors.white,
padding: EdgeInsets.all(18.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
),
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:robo_advisory/utils/constants.dart'; import 'package:robo_advisory/utils/constants.dart';
import 'package:robo_advisory/config/Routes.dart'; import 'package:robo_advisory/config/Routes.dart';
import 'package:robo_advisory/widgets/buttons.dart';
class RegisterSecondScreen extends StatelessWidget { class RegisterSecondScreen extends StatelessWidget {
@override @override
@ -57,14 +58,7 @@ class RegisterSecondScreen extends StatelessWidget {
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: ElevatedButton( child: ElevatedButton(
style: ElevatedButton.styleFrom( style: mainButtonStyle(),
backgroundColor: Color(0xFF495057),
foregroundColor: Colors.white,
padding: EdgeInsets.all(18.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
),
),
onPressed: () { onPressed: () {
Navigator.pushNamed(context, Routes.dashboard); Navigator.pushNamed(context, Routes.dashboard);
print('Next Step'); print('Next Step');

11
lib/widgets/buttons.dart Normal file
View file

@ -0,0 +1,11 @@
import 'package:flutter/material.dart';
mainButtonStyle() {
return ElevatedButton.styleFrom(
backgroundColor: Color(0xFF495057),
foregroundColor: Colors.white,
padding: EdgeInsets.all(18.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18.0),
));
}