Skip to content

Instantly share code, notes, and snippets.

@vishnuharidas
Created December 28, 2020 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishnuharidas/fcc5ba766747d65fe5aea9e84a836e2e to your computer and use it in GitHub Desktop.
Save vishnuharidas/fcc5ba766747d65fe5aea9e84a836e2e to your computer and use it in GitHub Desktop.
Simple drop-down like layout.
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