小编Geo*_*Lee的帖子

具有透明背景的 Flutter 卡片

我正在尝试使我的卡片透明,以便在背景中显示该内容。

我曾尝试将卡片的颜色属性设置为透明,但它显示为不透明的灰色背景。

结果

我也尝试使用具有不同不透明度的白色,但结果不是透明的纯白色。

   Card(
      color: Colors.transparent,
      child: Padding(
        padding: const EdgeInsets.all(16),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            CardLabelSmall("Current Premix Plan Document"),
            Expanded(child: PremixPlanDocList()),
            Row(
              children: <Widget>[
                Expanded(
                  child: RaisedButton(
                    onPressed: () async {
                      homeBloc.retrieveCurrentMrfPremixPlan();
                    },
                    child: const Text("Retrieve Premix Plan"),
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
Run Code Online (Sandbox Code Playgroud)

其他白色但仍然不是白色

color: Colors.white70,
color: Colors.white54,
color: Colors.white30,
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得透明的纯白色背景?

colors flutter

12
推荐指数
3
解决办法
3万
查看次数

Flutter 使用 Getx 关闭选定的对话框

我使用flutter已经有一段时间了,最​​近使用Get来实现状态管理。我在首先打开加载对话框然后打开消息对话框时遇到问题。然后我想关闭加载对话框,但消息对话框是保持关闭的对话框。

import 'package:flutter/material.dart';
import 'package:get/get.dart';

class HomeController extends GetxController {

  Future<void> openAndCloseLoadingDialog() async {
    showDialog(
      context: Get.overlayContext,
      barrierDismissible: false,
      builder: (_) => WillPopScope(
        onWillPop: () async => false,
        child: Center(
          child: SizedBox(
            width: 60,
            height: 60,
            child: CircularProgressIndicator(
              strokeWidth: 10,
            ),
          ),
        ),
      ),
    );

    await Future.delayed(Duration(seconds: 3));

    Get.dialog(
      AlertDialog(
        title: Text("This should not be closed automatically"),
        content: Text("This should not be closed automatically"),
        actions: <Widget>[
          FlatButton(
            child: Text("CLOSE"),
            onPressed: () {
              Get.back();
            },
          )
        ],
      ),
      barrierDismissible: false,
    ); …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-getx

5
推荐指数
1
解决办法
3万
查看次数

Nuxt Axios 动态网址

我设法通过使用以下教程来学习 nuxt

https://scotch.io/tutorials/implementing-authentication-in-nuxtjs-app

在教程中,它表明

axios: {
  baseURL: 'http://127.0.0.1:3000/api'
},
Run Code Online (Sandbox Code Playgroud)

它指向本地主机,这对我的开发来说不是问题,

但是在部署时,如何根据浏览器 URL 更改 URL,

如果系统在局域网中使用,它将 192.168.8.1:3000/api

如果系统在外面使用,它将是 example.com:3000/api

另一方面,目前我使用 adonuxt (adonis + nuxt),两者都监听同一个端口 (3000)。

将来,我可能会将其拆分为服务器(3333)和客户端(3000)

因此api链接将是

localhost:3333/api

192.168.8.1:3333/api

example.com:3333/api
Run Code Online (Sandbox Code Playgroud)

如何实现基于浏览器和交换机端口的动态api url?

proxy axios nuxt.js

3
推荐指数
1
解决办法
2756
查看次数

Dart 使用 IS 运算符检查泛型类型

当我的变量是通用的时,我在检查变量的类型时遇到了一些问题。

例子TList<MyClass>

T is List<MyClass>
//return false
T is List
//return false
Run Code Online (Sandbox Code Playgroud)

最后,我不得不使用一些愚蠢的方法才能得到正确的答案

T.toString() == "List<MyClass>"
//return true
Run Code Online (Sandbox Code Playgroud)

有没有标准的方法来处理,还是我需要坚持我的愚蠢方法直到正式发布?

generics dart

3
推荐指数
1
解决办法
929
查看次数

标签 统计

flutter ×2

axios ×1

colors ×1

dart ×1

flutter-getx ×1

generics ×1

nuxt.js ×1

proxy ×1