在注冊選項卡中創建帳戶后,我想在我的應用中添加影片
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: GestureDetector(
onTap: signUp,
child: Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.lightBlueAccent,
borderRadius: BorderRadius.circular(12),
),
child: Center(
child: Text(
'Sign Up',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
),
),
),
),
我只想在可能的移動應用程式中添加一些影片。我只想放一些影片,比如感謝您使用 JSON 注冊。先感謝您!!
uj5u.com熱心網友回復:
您可以創建一個自定義對話框,該對話框將在單擊注冊按鈕后顯示。就像這樣:
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
class CustomDialog extends StatelessWidget {
const CustomDialog({Key? key}) : super(key: key);
dialogContent(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(10),
boxShadow: [
const BoxShadow(
color: Colors.black26,
blurRadius: 10.0,
offset: Offset(0.0, 10.0),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min, // To make the card compact
children: <Widget>[
Align(
alignment: Alignment.topRight,
child: IconButton(
onPressed: () => Navigator.pop(context, false),
icon: const Icon(Icons.cancel)),
),
Lottie.asset('assets/animations/support.json',
width: 200, height: 200, fit: BoxFit.cover),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 40.0),
child: Text(
"New user has been successfuly created".toUpperCase(),
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
),
),
SizedBox(height: 24.0),
],
),
);
}
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
elevation: 0.0,
backgroundColor: Colors.transparent,
child: dialogContent(context),
);
}
}
并將其添加到您的注冊代碼中。
showDialog(
context: context,
builder: (BuildContext context) {
return CustomDialog();
});
uj5u.com熱心網友回復:
您可以使用該lottie軟體包:https ://pub.dev/packages/lottie
JSON-file只需從 Lottie Files 官方網站下載任何影片: https ://lottiefiles.com/并將其拖到您的應用程式資產檔案夾中
在pubspec.yaml檔案中添加資產:
flutter:
assets:
- assets/lottie/
現在在您的應用程式中顯示它:
Center(
child: Lottie.asset('assets/lottie/animation.json'),
);
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/522608.html
標籤:json扑镖动画
上一篇:如何在dart中撰寫多個條件?
