Skip to content

Instantly share code, notes, and snippets.

@mravn-google mravn-google/main.dart Secret
Last active Jul 5, 2018

Embed
What would you like to do?
Widget composition
import 'package:flutter/material.dart';
import 'src/widgets.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Widget imageSection = ...
final Widget titles = ...
final Widget titleSection = ...
final Widget actionSection = Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Action(label: 'CALL', icon: Icons.call),
Action(label: 'ROUTE', icon: Icons.near_me),
Action(label: 'SHARE', icon: Icons.share),
],
),
);
final Widget textSection = ...
final Widget scaffold = ...
return MaterialApp(
title: 'Flutter Demo',
home: scaffold,
);
}
}
import 'package:flutter/material.dart';
class Action extends StatelessWidget {
Action({Key key, this.label, this.icon}) : super(key: key);
final String label;
final IconData icon;
@override
Widget build(BuildContext context) {
final Color color = Theme.of(context).primaryColor;
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(icon, color: color),
Container(
margin: const EdgeInsets.only(top: 8.0),
child: Text(
label,
style: TextStyle(
fontSize: 12.0,
fontWeight: FontWeight.w400,
color: color,
),
),
),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.