Created with <3 with dartpad.dev.
Created
March 5, 2023 17:41
-
-
Save diegoveloper/0802859474f1a2f855e9153141302bce to your computer and use it in GitHub Desktop.
quintessential-gorge-7113
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
const Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith( | |
scaffoldBackgroundColor: darkBlue, | |
), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.green, | |
body: Container( | |
child: Column( | |
children: <Widget>[ | |
Expanded( | |
child: Row( | |
children: <Widget>[ | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
), | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
), | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
) | |
], | |
), | |
), | |
Expanded( | |
child: Row( | |
children: <Widget>[ | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
), | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
), | |
Expanded( | |
child: MyOwnButton( | |
child: Text('test'), | |
onPressed: () => null, | |
), | |
) | |
], | |
), | |
) | |
], | |
), | |
), | |
); | |
} | |
} | |
class MyOwnButton extends StatelessWidget { | |
const MyOwnButton({ | |
required this.child, | |
this.onPressed, | |
super.key, | |
}); | |
final Widget child; | |
final VoidCallback? onPressed; | |
@override | |
Widget build(BuildContext context) { | |
return DecoratedBox( | |
decoration: BoxDecoration( | |
border: Border.all(color: Colors.black, width: 2), | |
), | |
child: InkWell( | |
onTap: onPressed, | |
child: Center(child: child,), | |
),); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment