-
-
Save valterh4ck3r/7cc594793615eb364ac2d19eb97cf79c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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