小编Aha*_*ves的帖子

Flutter:如何在 ListView 中均匀间隔 ListTiles

我正在尝试使用下面的代码在我的列表视图中均匀地间隔我的列表图块,但它不起作用。更大的目标是在旋转时获得滚动和均匀分布。谢谢您的帮助。

      Widget _buildBodyListView() {
        return new Container(
          padding: EdgeInsets.all(12.0),
          child: Container(color: Colors.green,
            child: ListView(shrinkWrap: false,
              children: <Widget>[
                ListTile(
                  trailing: Icon(Icons.keyboard_arrow_right),
                  title: Text('LATEST NEWS', textAlign: TextAlign.center,),
                ),
                ListTile(
                  trailing: Icon(Icons.keyboard_arrow_right),
                  title: Text('MARKET NEWS ', textAlign: TextAlign.center,),
                ),
                ListTile(
                  trailing: Icon(Icons.keyboard_arrow_right),
                  title: Text('MARKET REPORT', textAlign: TextAlign.center,),
                ),
             ListTile(
              trailing: Icon(Icons.keyboard_arrow_right),
              title: Text('LATEST NEWS', textAlign: TextAlign.center,),
            ),
            ListTile(
              trailing: Icon(Icons.keyboard_arrow_right),
              title: Text('MARKET NEWS ', textAlign: TextAlign.center,),
            ),
            ListTile(
              trailing: Icon(Icons.keyboard_arrow_right),
              title: Text('MARKET REPORT', textAlign: TextAlign.center,),
            ),

              ],
            ),
          ),
        );
      }
Run Code Online (Sandbox Code Playgroud)

flutter

16
推荐指数
4
解决办法
4万
查看次数

如何使用SQL表填充DataTable

我目前正在使用Page_Load中的以下代码创建和读取DataTable

protected void Page_Load(object sender, EventArgs e)
{
    if (Session["AllFeatures1"] == null)
    {
        Session["AllFeatures1"] = GetData();
    }
    table = (DataTable)Session["AllFeatures1"];
    DayPilotCalendar1.DataSource = Session["AllFeatures1"];
    DayPilotNavigator1.DataSource = Session["AllFeatures1"];

    if (!IsPostBack)
    {
        DataBind();
        DayPilotCalendar1.UpdateWithMessage("Welcome!");
    }

    if (User.Identity.Name != "")
    {
        Panel1.Visible = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

我想知道如何转换此代码,以便从SQL查询中读取?我正在尝试下面的代码,但我不知道如何连接它们,以便我的页面加载数据表填充下面的SQL命令.

SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["BarManConnectionString"].ConnectionString);
conn.Open();
string query = "SELECT * FROM [EventOne]";

SqlCommand cmd = new SqlCommand(query, conn);

DataTable t1 = new DataTable();
using (SqlDataAdapter a = new SqlDataAdapter(cmd))
{
    a.Fill(t1);
}
Run Code Online (Sandbox Code Playgroud)

.net c# sql datatable

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

如何将HashMap添加到ArrayList

有人可以告诉我为什么下面的代码用ArrayList中的最新条目覆盖ArrayList中的每个元素?或者如何正确地将新的hashmap元素添加到我的ArrayList中?

ArrayList<HashMap<String, String>> prodArrayList = new ArrayList<HashMap<String, String>>();

HashMap<String, String> prodHashMap = new HashMap<String, String>();

public void addProd(View ap)
{
    // test arraylist of hashmaps
    prodHashMap.put("prod", tvProd.getText().toString());

    prodArrayList.add(prodHashMap);

    tvProd.setText("");

    // check data ///

    Log.e("myLog","Data prodArrayList in ADD Method Size = "+prodArrayList.size());

    for(int i=0; i< prodArrayList.size();i++)
    {
         Log.e("myLog","Data prodArrayList in ADD Method = "+prodArrayList.get(i).toString());
    }
}
Run Code Online (Sandbox Code Playgroud)

java android arraylist

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

Firestore 查询 orderBy 不起作用?

FutureBuilder 在类型时间戳字段上使用 Firestore 查询返回快照中没有数据。但是,没有 orderBy 的相同查询工作得很好。
我错过了什么?谢谢您的帮助。

// Working code
future: Firestore.instance.collection('messages').where('toid',isEqualTo: _emailID).getDocuments(),
builder: (context, snapshot) ...

// Not Working - returns to if(!snapshot.hasData)
future: Firestore.instance.collection('messages').where('toid',isEqualTo: _emailID).orderBy('_timeStampUTC', descending: true).getDocuments(),
builder: (context, snapshot) ...
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

firebase flutter google-cloud-firestore

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

我可以使用新项目但使用相同的Bundle ID更新iTunes App吗?

如果我通过创建具有相同Bundle ID的新项目来更新当前位于App Store中的旧应用程序,我的用户是否会丢失他们存储的数据NSUserDefaults

所有代码都将被复制/粘贴到新项目中; 启用ARC将是主要的变化.

nsuserdefaults ios

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

Flutter:如何创建一个透明的小部件类?

我想创建一个容器大小为 250x500 的新小部件类,其余的类/小部件不透明度为 0.5 - 允许之前的小部件 - 我们从中启动 - 部分可见。

这可能吗 ?如果是这样怎么办?

-谢谢

下面是我正在调用的 Stateful 类

class ShowMyTitles extends StatefulWidget {
  @override
  _ShowMyTitlesState createState() => _ShowMyTitlesState();
}

class _ShowMyTitlesState extends State<ShowMyTitles> {


  List<Map<String, bool>> myListOfMapTitles;
  Map<String, bool> valuesHeaders;
  int trueCount = 0;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    SettingsForMap SFM = new SettingsForMap();
    myListOfMapTitles = SFM.myListOfMapTitles;
    valuesHeaders = SFM.valuesHeaders;
  }


  @override
  Widget build(BuildContext context) {

    List myTitles = [];

    return new WillPopScope(
      onWillPop: (){
        myListOfMapTitles.forEach((valuesAll) {
          valuesAll.forEach((s,b){ …
Run Code Online (Sandbox Code Playgroud)

dart flutter

2
推荐指数
1
解决办法
7665
查看次数

如何将FutureBuilder &lt;File&gt;转换为BoxDecoraiton图像

使用flutter插件image_picker 0.4.4我正在使用以下内容显示来自相机或画廊的图像

  Widget _previewImageBkg() {
    return FutureBuilder<File>(
        future: _imageFileBkg,
        builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
          if (snapshot.connectionState == ConnectionState.done && snapshot.data != null) {
            print('_previewImage.........check callback for this image. .>>>>>');
            final File file = snapshot.data;

            myBgURL = uploadFile('user@image.com_B.jpg', file);

            return Image.file(snapshot.data);

          } else if (snapshot.error != null) {
            return const Text(
              'Error picking image.',
              textAlign: TextAlign.center,
            );
          } else {
            return const Text(
              'You have not yet picked an image.',
              textAlign: TextAlign.center,
            );
          }
        }
        )
Run Code Online (Sandbox Code Playgroud)

如果将其放入容器中,图像的显示效果会很好

return Scaffold(
      appBar: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

Flutter:类型“ UIApplication”没有成员“ openSettingsURLString”

我尝试让geolocator 2.1.0插件与我的ios xcode项目一起使用,并在运行pod install之后得到以下2错误

类型“ UIApplication”没有成员“ openSettingsURLString”,并且“ OpenExternalURLOptionsKey”不是“ UIApplication”的成员类型

采取的步骤。

  1. 我打开一个新的Flutter项目(无论是否选中“ Swift支持”,都会发生错误)-获取默认应用。

  2. 更新我pubspec.yaml文件只- geolocator:^ 2.1.0

  3. 运行“ flutter pacakges get”和“ pod install”。所有库均在AndroidStudio和XCode 9.2中显示。

希望我缺少一些简单的东西。感谢您的帮助。

Podfile看起来像这样

(我已经用'config.build_settings ['SWIFT_VERSION'] ='4.1''更新了文件)。

# Uncomment this line to define a global platform for your project
platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

def parse_KV_file(file, separator='=')
  file_abs_path = File.expand_path(file)
  if !File.exists? file_abs_path
    return [];
  end
  pods_ary = []
  skip_line_start_symbols = ["#", "/"]
  File.foreach(file_abs_path) { |line|
      next …
Run Code Online (Sandbox Code Playgroud)

xcode flutter

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

Flutter:如何仅传输 firestore 文档中的一个字段?

您如何(或者是否有可能)仅流式传输 Firestore 文档中的一个字段。我只想为一个键值(即列表)传输数据?例如:

DocumentSnapshot {
    'firstname':'Joe',
    'lastname':'Smith',
    'friendsList': [one@one.com, two@two.com, three@three.com]
}
Run Code Online (Sandbox Code Playgroud)

我可以仅流式传输“friendsList”字段还是必须提取整个 DocumentSnapshot ?

stream flutter google-cloud-firestore

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