Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。

详情请查看

效果图:

实现代码:

//弹出底部拍照、选择照片、选择小时对话框
Future<int?> _showModalBottomSheet() {
  return showModalBottomSheet<int>(
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.only(
        topLeft: Radius.circular(15),
        topRight: Radius.circular(15)
      )
    ),
    context: context,
    isScrollControlled: true,
    builder: (BuildContext context) {
      return Container(
        height: 253,
        child: Column(
          children: [
            InkWell(
              onTap: (){
                Navigator.pop(context);
                _openAblumPermission(MEDIA_TYPE_TAKE_PHOTO);
              },
              child: Container(
                alignment: AlignmentDirectional.center,
                height: 60,
                child: Text("拍照", style: TextStyle(fontSize: 22,),),
              ),
            ),

            Container(
              color: Colors.grey.shade400,
              height: 0.3,
            ),

            InkWell(
              onTap: (){
                Navigator.pop(context);
                _openAblumPermission(MEDIA_TYPE_PICTURE);
              },
              child: Container(
                alignment: AlignmentDirectional.center,
                height: 60,
                child: Text("选择照片", style: TextStyle(fontSize: 22,),),
              ),
            ),

            Container(
              color: Colors.grey.shade400,
              height: 0.3,
            ),

            InkWell(
              onTap: (){
                Navigator.pop(context);
                _openAblumPermission(MEDIA_TYPE_VIDEO);
              },
              child: Container(
                alignment: AlignmentDirectional.center,
                height: 60,
                child: Text("选择小视频", style: TextStyle(fontSize: 22,),),
              ),
            ),

            Container(
              color: Colors.grey.shade200,
              height: 12,
            ),

            InkWell(
              onTap: (){
                LogUtils.d("点击取消");
                Navigator.pop(context);
              },
              child: Container(
                alignment: AlignmentDirectional.center,
                height: 60,
                child: Text("取消", style: TextStyle(fontSize: 22,),),
              ),
            ),

          ],
        ),
      );
    },
  );
}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐