Created
March 28, 2021 11:11
-
-
Save dumazy/028daa76945938f0e5c14aea6a8bf84b to your computer and use it in GitHub Desktop.
This file contains 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
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return SizedBox( | |
width: 500.0, | |
child: Column( | |
children: [ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: ['English', 'Russian', 'Spanish'] | |
.map((language) => LanguageButton( | |
language: language, | |
)) | |
.toList(), | |
), | |
SizedBox(height: 20,), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: ['Some really long language', 'French', 'German'] | |
.map((language) => LanguageButton( | |
language: language, | |
)) | |
.toList(), | |
), | |
], | |
), | |
); | |
} | |
} | |
class LanguageButton extends StatelessWidget { | |
final String language; | |
const LanguageButton({Key? key, required this.language}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return OutlinedButton( | |
style: OutlinedButton.styleFrom( | |
shape: const RoundedRectangleBorder( | |
borderRadius: BorderRadius.all( | |
Radius.circular(30), | |
), | |
), | |
), | |
onPressed: () { | |
// TODO | |
}, | |
child: Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 8.0), | |
child: Text(language), | |
), | |
); | |
} | |
} | |
import 'package:flutter/material.dart'; | |
final 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 SizedBox( | |
width: 500.0, | |
child: Column( | |
children: [ | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: ['English', 'Russian', 'Spanish'] | |
.map((language) => LanguageButton( | |
language: language, | |
)) | |
.toList(), | |
), | |
SizedBox(height: 20,), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
children: ['Some really long language', 'French', 'German'] | |
.map((language) => LanguageButton( | |
language: language, | |
)) | |
.toList(), | |
), | |
], | |
), | |
); | |
} | |
} | |
class LanguageButton extends StatelessWidget { | |
final String language; | |
const LanguageButton({Key? key, required this.language}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return OutlinedButton( | |
style: OutlinedButton.styleFrom( | |
shape: const RoundedRectangleBorder( | |
borderRadius: BorderRadius.all( | |
Radius.circular(30), | |
), | |
), | |
), | |
onPressed: () { | |
// TODO | |
}, | |
child: Padding( | |
padding: const EdgeInsets.symmetric(horizontal: 20.0, vertical: 8.0), | |
child: Text(language), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment