Skip to content

Instantly share code, notes, and snippets.

@bt1159
Created December 1, 2023 20:18
Show Gist options
  • Save bt1159/d47d23676be94db82f3d49430a1a4ac5 to your computer and use it in GitHub Desktop.
Save bt1159/d47d23676be94db82f3d49430a1a4ac5 to your computer and use it in GitHub Desktop.
Demonstrating spacing on Flutter icons
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Example(),
);
}
}
class Example extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(children: [
const Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text('This is a test', style: TextStyle(fontSize: 20, backgroundColor: Colors.red),),
Text('Here is more text with no spaces', style: TextStyle(fontSize: 20, backgroundColor: Colors.red),),
Icon(Icons.square)
]
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text('This is a test', style: TextStyle(fontSize: 20, backgroundColor: Colors.red),),
SizedBox(width: 30, height: 10, child: Container(padding: EdgeInsets.zero, color: Colors.blue)),
const Icon(Icons.square)
]
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text('This is a test', style: TextStyle(fontSize: 20, backgroundColor: Colors.red),),
SizedBox(width: 30, height: 10, child: Container(padding: EdgeInsets.zero, color: Colors.blue)),
SizedBox(width: 30, height: 10, child: Container(padding: EdgeInsets.zero, color: Colors.blue)),
const Icon(Icons.square)
]
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Text('This is a test', style: TextStyle(fontSize: 20, backgroundColor: Colors.red),),
SizedBox(width: 30, height: 10, child: Container(padding: EdgeInsets.zero, color: Colors.blue)),
SizedBox(width: 30, height: 10, child: Container(padding: EdgeInsets.zero, color: Colors.blue)),
const Padding(padding: EdgeInsets.zero, child: Icon(Icons.square)),
const Padding(padding: EdgeInsets.zero, child: Icon(Icons.add_circle)),
const Padding(padding: EdgeInsets.zero, child: Icon(Icons.add_circle)),
]
),
])
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment