Skip to content

Instantly share code, notes, and snippets.

@dickermoshe
Last active April 7, 2024 13:51
Show Gist options
  • Save dickermoshe/4aa1ad145d994fda54c9e87556f38bd9 to your computer and use it in GitHub Desktop.
Save dickermoshe/4aa1ad145d994fda54c9e87556f38bd9 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(mainAxisSize: MainAxisSize.min, children: [
Text("Default, Slightly Off Center"),
SizedBox(width: 8),
FilterChip(
label: Text("Test Text"),
onSelected: (_) {},
onDeleted: () {},
deleteIcon: Icon(Icons.expand_more),
)
]),
Row(mainAxisSize: MainAxisSize.min, children: [
Text("Label Medium, Very Off Center"),
SizedBox(width: 8),
FilterChip(
labelStyle: Theme.of(context).textTheme.labelMedium,
label: Text("Test Text"),
onSelected: (_) {},
onDeleted: () {},
deleteIcon: Icon(Icons.expand_more),
)
]),
Row(mainAxisSize: MainAxisSize.min, children: [
Text("Custom Padding ---------- Fixed"),
SizedBox(width: 8),
FilterChip(
labelStyle: Theme.of(context).textTheme.labelMedium,
label: Text("Test Text"),
onSelected: (_) {},
onDeleted: () {},
padding: EdgeInsets.only(left: 16),
labelPadding: EdgeInsets.only(left: 0, right: 0),
deleteIcon: Icon(Icons.expand_more),
)
]),
Row(mainAxisSize: MainAxisSize.min, children: [
Text("Label Medium, Very Off Center"),
SizedBox(width: 8),
FilterChip(
labelStyle: Theme.of(context).textTheme.labelMedium,
label: Text("Test Text With More Text"),
onSelected: (_) {},
onDeleted: () {},
deleteIcon: Icon(Icons.expand_more),
)
]),
Row(mainAxisSize: MainAxisSize.min, children: [
Text("Custom Padding ---------- Fixed"),
SizedBox(width: 8),
FilterChip(
labelStyle: Theme.of(context).textTheme.labelMedium,
label: Text("Test Text With More Text"),
onSelected: (_) {},
onDeleted: () {},
padding: EdgeInsets.only(left: 16),
labelPadding: EdgeInsets.only(left: 0, right: 0),
deleteIcon: Icon(Icons.expand_more),
)
]),
],
mainAxisSize: MainAxisSize.min),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment