parent
0879398add
commit
a1c80c00b9
@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'ios_toast.dart';
|
||||
|
||||
/// Example to show how to popup overlay with custom animation.
|
||||
class CustomAnimationToast extends StatelessWidget {
|
||||
final double value;
|
||||
|
||||
static final Tween<Offset> tweenOffset = Tween<Offset>(begin: Offset(0, 40), end: Offset(0, 0));
|
||||
|
||||
static final Tween<double> tweenOpacity = Tween<double>(begin: 0, end: 1);
|
||||
|
||||
const CustomAnimationToast({Key key, @required this.value}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Transform.translate(
|
||||
offset: tweenOffset.transform(value),
|
||||
child: Opacity(
|
||||
child: IosStyleToast(),
|
||||
opacity: tweenOpacity.transform(value),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MessageNotification extends StatelessWidget {
|
||||
//
|
||||
final VoidCallback onReply;
|
||||
final String avatar;
|
||||
final String nickname;
|
||||
final String content;
|
||||
|
||||
const MessageNotification({
|
||||
Key key,
|
||||
@required this.onReply,
|
||||
@required this.avatar,
|
||||
@required this.nickname,
|
||||
@required this.content,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: SafeArea(
|
||||
child: ListTile(
|
||||
leading: SizedBox.fromSize(
|
||||
size: const Size(40, 40),
|
||||
child: ClipOval(child: Image.network(avatar))),
|
||||
title: Text(nickname),
|
||||
subtitle: Text(content),
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.reply),
|
||||
onPressed: () {
|
||||
if (onReply != null) onReply();
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IosStyleToast extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: DefaultTextStyle(
|
||||
style: Theme.of(context).textTheme.bodyText2.copyWith(color: Colors.white),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Container(
|
||||
color: Colors.black87,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
horizontal: 16,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.check,
|
||||
color: Colors.white,
|
||||
),
|
||||
Text('Succeed')
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 73 KiB |
Loading…
Reference in new issue