视频直播源码,Flutter实现一个自定义的弹窗

视频直播源码,Flutter实现一个自定义的弹窗

1
import 'package:flutter/material.dart';<br> <br>class AppDialog extends Dialog {<br>  final String title;<br>  final String? confirm;<br>  final String? cancel;<br>  final String? content;<br>  final String? cancelColor;<br>  final String? confirmColor;<br>  final bool? showCancel;<br>  final OnDialogClickListener? clickListener;<br> <br>  const AppDialog(<br>      {this.cancelColor = '#00000',<br>      this.confirmColor = ''#576B95'',<br>      this.title = '标题',<br>      this.cancel = '取消',<br>      this.confirm = '确定',<br>      this.content = '',<br>      this.showCancel = true,<br>      this.clickListener,<br>      Key? key})<br>      : super(key: key);<br> <br>  @override<br>  Widget build(BuildContext context) {<br>    return Center(<br>      child: Container(<br>        constraints: const BoxConstraints(maxHeight: 600),<br>        width: double.infinity,<br>        margin: const EdgeInsets.all(30),<br>        decoration: const ShapeDecoration(<br>            color: Colors.white,<br>            shape: RoundedRectangleBorder(<br>                borderRadius: BorderRadius.all(Radius.circular(5.0)))),<br>        child: Column(<br>          mainAxisAlignment: MainAxisAlignment.start,<br>          crossAxisAlignment: CrossAxisAlignment.center,<br>          mainAxisSize: MainAxisSize.min,<br>          children: [<br>            Container(<br>              margin: const EdgeInsets.only(top: 12, bottom: 14),<br>              child: Text(<br>                title,<br>                style: const TextStyle(<br>                    fontSize: 18,<br>                    fontWeight: FontWeight.bold,<br>                    color: Colors.black),<br>              ),<br>            ),<br>            Offstage(<br>              offstage: content!.isEmpty,<br>              child: Container(<br>                margin: const EdgeInsets.only(bottom: 17),<br>                child: Text(<br>                  content!,<br>                  style:<br>                      TextStyle(fontSize: 17, color: ThemeColors.color7f7f7f),<br>                ),<br>              ),<br>            ),<br>            Container(<br>              height: 0.7,<br>              color: ThemeColors.colorE8E8E8,<br>            ),<br>            getBottomWidget(context),<br>          ],<br>        ),<br>      ),<br>    );<br>  }<br> <br>  getBottomWidget(context) {<br>    if (showCancel!) {<br>      return SizedBox(<br>        height: 43,<br>        child: Row(<br>          children: <Widget>[<br>            Expanded(<br>              child: InkWell(<br>                child: Container(<br>                  alignment: Alignment.center,<br>                  child: Text(<br>                    cancel!,<br>                    style: const TextStyle(<br>                        fontSize: 17,<br>                        color: Colors.black,<br>                        fontWeight: FontWeight.bold),<br>                  ),<br>                ),<br>                onTap: () => {<br>                  clickListener?.onCancel(),<br>                  Navigator.of(context).pop(),<br>                },<br>              ),<br>            ),<br>            Container(<br>              height: 43,<br>              width: 0.7,<br>              color: ThemeColors.colorE8E8E8,<br>            ),<br>            Expanded(<br>              child: InkWell(<br>                child: Container(<br>                  alignment: Alignment.center,<br>                  child: Text(<br>                    confirm!,<br>                    style: TextStyle(<br>                        fontSize: 17,<br>                        color: ThemeColors.color576B95,<br>                        fontWeight: FontWeight.bold),<br>                  ),<br>                ),<br>                onTap: () => {clickListener?.onConfirm(), Navigator.of(context).pop()},<br>              ),<br>            ),<br>          ],<br>        ),<br>      );<br>    } else {<br>      return InkWell(<br>        child: Container(<br>          height: 43,<br>          alignment: Alignment.center,<br>          child: Text(<br>            confirm!,<br>            style: TextStyle(<br>                fontSize: 17,<br>                color: ThemeColors.color576B95,<br>                fontWeight: FontWeight.bold),<br>          ),<br>        ),<br>        onTap: () => {<br>          clickListener?.onConfirm(),<br>          Navigator.of(context).pop(),<br>        },<br>      );<br>    }<br>  }<br>}<br> <br>abstract class OnDialogClickListener {<br>  void onConfirm();<br>  void onCancel();<br>}

​以上就是 视频直播源码,Flutter实现一个自定义的弹窗,更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(82)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2021-08-16 在小视频app源码中实现Camera预览旋转设置
2021-08-16 1对1直播源码实现录音和播放
2021-08-16 Kotlin实现一对一直播软件源码底部弹出的列表对话框
点击右上角即可分享
微信分享提示