Skip to content

Instantly share code, notes, and snippets.

@HelloCore
Created June 1, 2021 15:02
Show Gist options
  • Save HelloCore/5164e5302e0631fdde2c3cca69d82345 to your computer and use it in GitHub Desktop.
Save HelloCore/5164e5302e0631fdde2c3cca69d82345 to your computer and use it in GitHub Desktop.
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: ListView.builder(itemBuilder: (ctx, index) {
return MyTile();
}, itemCount: 200),
),
);
}
}
class MyTile extends StatefulWidget {
@override
_MyTileState createState() => _MyTileState();
}
class _MyTileState extends State<MyTile> {
var _isExpanded = false;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
setState(() {
_isExpanded = !_isExpanded;
});
},
child: AnimatedContainer(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
height: _isExpanded ? 100 : 50,
duration: Duration(milliseconds: 200),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [Text('Hello'), Text('World')],
),
Icon(Icons.navigate_next)
],
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment