Skip to content

Instantly share code, notes, and snippets.

@diegoveloper
Created March 5, 2023 17:41
Show Gist options
  • Save diegoveloper/0802859474f1a2f855e9153141302bce to your computer and use it in GitHub Desktop.
Save diegoveloper/0802859474f1a2f855e9153141302bce to your computer and use it in GitHub Desktop.
quintessential-gorge-7113

quintessential-gorge-7113

Created with <3 with dartpad.dev.

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