v0.0.9speech_bubble
Flutter에서 대화창을 에뮬레이트하는 위젯입니다.
빨간색 인스타그램 알림 팝업을 기반으로 한 사용자 지정 플러터 위젯으로, 플러터 앱 내에서 툴팁과 팝업을 표시합니다.
{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A flutter widget that emulates a speech bubble.
This widget is modeled after the red Instagram notification popups.
Screenshot
Dart Pub: https://pub.dartlang.org/packages/speech_bubble#-installing-tab-
Depend on it
Add this to your package's pubspec.yaml file:
speech_bubble: ^0.0.5
Install it
You can install packages from the command line:
$ flutter packages get
Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.
Import it
Now in your Dart code, you can use:
import 'package:speech_bubble/speech_bubble.dart';
Creates a widget that emulates a speech bubble. Could be used for a tooltip, or as a pop-up notification, etc.
The child contained by the SpeechBubble.
The location of the nip of the speech bubble. Use the NipLocation enum, either TOP, RIGHT, BOTTOM, or LEFT. The nip will automatically center to the side that it is assigned.
The color of the body of the SpeechBubble and nip. Defaultly red.
The borderRadius of the SpeechBubble. The SpeechBubble is built with a circular border radius on all 4 corners.
The explicitly defined height of the SpeechBubble. The SpeechBubble will defaultly enclose its child.
The explicitly defined width of the SpeechBubble. The SpeechBubble will defaultly enclose its child.
The padding widget between the child and the edges of the SpeechBubble.
import 'package:flutter/material.dart';
import 'package:speech_bubble/speech_bubble.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: const Text('Plugin example app'),
),
body: new Center(
child: new SpeechBubble(
nipLocation: NipLocation.BOTTOM,
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Text("Give your users some guided instruction"),
// Text("From the inside of a Speech Bubble")
// ],
// ),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.favorite,
color: Colors.white,
),
Padding(
padding: const EdgeInsets.all(4.0),
),
Text(
"1",
style: TextStyle(
color: Colors.white,
fontSize: 18.0,
),
),
],
),
),
),
),
);
}
}