Skip to content

Instantly share code, notes, and snippets.

@mjohnsullivan
Created December 1, 2019 21:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mjohnsullivan/0ca884172ae40ccabeaaa3e30451dab3 to your computer and use it in GitHub Desktop.
Save mjohnsullivan/0ca884172ae40ccabeaaa3e30451dab3 to your computer and use it in GitHub Desktop.
A Flutter button comprising a raised icon with a border and some text
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.lightBlue,
body: Center(
child: BorderIconButton(),
),
),
);
}
}
class BorderIconButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Material(
shape: const CircleBorder(
side: BorderSide(color: Colors.white, width: 4)),
elevation: 6,
color: Theme.of(context).accentColor,
child: InkWell(
customBorder: CircleBorder(),
onTap: () {},
child: const Padding(
padding: EdgeInsets.all(10),
child: Icon(
Icons.flight,
size: 60,
color: Colors.white,
),
),
),
),
const SizedBox(height: 10),
const Text(
'Citabria\n7ECA',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment