Skip to content

Instantly share code, notes, and snippets.

@gitaaron
Created September 11, 2021 16:17
Show Gist options
  • Save gitaaron/3bcc0ff8b297a219ae3dc6bd9243f136 to your computer and use it in GitHub Desktop.
Save gitaaron/3bcc0ff8b297a219ae3dc6bd9243f136 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: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
final items = List<String>.generate(100, (i) => "Item $i");
@override
Widget build(BuildContext context) {
return Padding(padding:EdgeInsets.only(top:30.0),
child:Column(
children:[
Padding(padding:EdgeInsets.all(20.0), child:Text('List is now clipped!', style: Theme.of(context).textTheme.headline4)),
Expanded(
child:Card(child:ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
hoverColor:Colors.red,
selected:index==0,
selectedTileColor:Colors.green,
title: Padding(padding:EdgeInsets.all(30.0), child:Text('${items[index]}')),
onTap:() { print('on tapped'); }
);
},
))),
]
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment