Created
December 28, 2020 07:31
-
-
Save vishnuharidas/fcc5ba766747d65fe5aea9e84a836e2e to your computer and use it in GitHub Desktop.
Simple drop-down like layout.
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
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 Container( | |
width: 160, | |
height: 40, | |
decoration: BoxDecoration( | |
borderRadius: BorderRadius.all(Radius.circular(100)), | |
color: Colors.white, | |
), | |
child: Stack( | |
children: [ | |
Positioned.fill( | |
child: Center( | |
child: Text( | |
"YYYY", | |
style: TextStyle(color: Colors.black, fontSize: 20) | |
), | |
), | |
), | |
Align( | |
alignment: Alignment.centerRight, | |
child: Padding( | |
padding: EdgeInsets.only(right: 10), | |
child: Icon( | |
Icons.arrow_drop_down, | |
color: Colors.black, | |
size: 32, | |
) | |
), | |
), | |
] | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment