Skip to content

Instantly share code, notes, and snippets.

@jacobaraujo7
Created April 16, 2019 19:05
Show Gist options
  • Save jacobaraujo7/cb36fb6553cc90db18fbe59d09f6268b to your computer and use it in GitHub Desktop.
Save jacobaraujo7/cb36fb6553cc90db18fbe59d09f6268b to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'dart:math' as math;
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomeWidget(),
);
}
}
class HomeWidget extends StatefulWidget {
@override
_HomeWidgetState createState() => _HomeWidgetState();
}
class _HomeWidgetState extends State<HomeWidget> {
@override
Widget build(BuildContext context) {
return Material(
child: Center(
child: BalloonWidget(
height: 80,
width: 200,
color: Colors.grey[800],
child: Row(
children: <Widget>[
IconButton(icon: Icon(Icons.home, color: Colors.white,), onPressed: () {},),
IconButton(icon: Icon(Icons.share, color: Colors.white,), onPressed: () {},),
IconButton(icon: Icon(Icons.keyboard, color: Colors.white,), onPressed: () {},),
Padding(
padding: const EdgeInsets.symmetric(vertical: 14),
child: Container(height: double.infinity, width: 1, color: Colors.white,),
),
IconButton(icon: Icon(Icons.palette, color: Colors.white,), onPressed: () {},),
],
),
),
),
);
}
}
//widget que faz o balao
class BalloonWidget extends StatelessWidget {
final double height;
final double width;
final Color color;
final Widget child;
const BalloonWidget({Key key, this.height, this.width, this.child, this.color})
: super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: height,
width: width,
child: Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(12),
),
width: width,
height: height * 0.8,
child: child,
),
Align(
alignment: Alignment.bottomCenter,
child: Transform.rotate(
angle: math.pi * 0.25,
child: Container(
color: color,
height: (height * 0.8) / 2,
width: (height * 0.8) / 2,
),
),
)
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment