小编Joh*_*Joe的帖子

找不到与给定名称匹配的资源(在'android:color Primary')

<resources>
  <!-- inherit from the material theme -->
 <style name="AppTheme" parent="android:Theme.Material">
   <!-- Main theme colors -->
   <!--   your app branding color for the app bar -->
   <item name="android:colorPrimary">@color/primary</item>
   <!--   darker variant for the status bar and contextual app bars -->
   <item name="android:colorPrimaryDark">@color/primary_dark</item>
   <!--   theme UI controls like checkboxes and text fields -->
   <item name="android:colorAccent">@color/accent</item>
 </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

请尝试解决问题.

android material-design

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

颤动圆角底部导航栏

我在 ClipRRect 中有一个底部导航栏(用于提供圆角)。它有圆角,但没有透明角。我正在分享图像来显示问题。如何制作透明圆角?

代码:

bottomNavigationBar: ClipRRect(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(30.0),
          topRight: Radius.circular(30.0),
        ),
        child: BottomNavigationBar(
          currentIndex: _selectedIndex,
          selectedItemColor: Colors.amber[800],
          onTap: _onItemTapped,
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(Icons.home),
              label: 'Home',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.search),
              label: 'Search',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.person),
              label: 'Profile',
            ),
          ],
        ),
      ),
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

flutter android-bottomnav flutter-layout

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

uriString 空指针错误

在 Activity A 中,它有 listView 和一个图标,用于意图 Activity B。

\n\n
 listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { //listview\n            public void onItemClick(AdapterView<?> listView, View view, final int position, long id) {\n                Expenses o = (Expenses) obj.getItem(position);\n                Uri image = o.getImage();\n                Intent intent = new Intent(QuickExpenses.this,AddExpenses.class);\n                intent.putExtra("image",image.toString());\n                startActivity(intent);\n            }\n        });\n\n  @Override\n    public boolean onOptionsItemSelected(MenuItem item) { // get action bar icon\n    switch (item.getItemId()) {\n            case R.id.action_add_task:\n                mClickedPosition = -1;\n                Intent intent = new Intent(QuickExpenses.this, AddExpenses.class);\n                startActivityForResult(intent, PROJECT_REQUEST_CODE);\n                return true;\n    }\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

活动B

\n\n
 if(getIntent().getExtras()!=null) { //if  has …
Run Code Online (Sandbox Code Playgroud)

android uri image android-intent

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

层次结构查看器消失了

它曾经工作得很好.但最近我升级Android Studio到2.3,我发现层次结构查看器消失了.我无法在sdk/tools目录和Android设备监视器中找到它.

在此输入图像描述

在此输入图像描述

hierarchyviewer

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

使用不包含 Bloc&lt;dynamic,dynamic&gt; 类型的 Bloc 的上下文调用 BlocProvider.of()

\n

错误:I / flutter(5919):\ xe2 \ x95 \ x90 \ xe2 \ x95 \ x90 \ xe2 \ x95 \ xa1小部件库捕获异常\ n \ xe2 \ x95 \ x9e \ xe2 \ x95 \ x90 \ xe2 \ x95 \x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90 \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2 \x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95 \x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90 \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2 \x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95 \x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90 I/颤动\n ( 5919): 构建 Builder 时抛出以下断言:\n I/flutter (5919): 使用不包含 Bloc 类型的 Bloc 的上下文调用 BlocProvider.of()。I/flutter ( 5919):从传递给 I/flutter ( 5919) 的上下文开始找不到祖先:\n BlocProvider.of>()。I/flutter ( 5919):
\n 如果您使用的上下文来自 BlocProvider 之上的小部件,则可能会发生这种情况。I/flutter(5919):使用的上下文是:\n BlocBuilder,动态>(脏,状态:I/flutter(\n 5919):_BlocBuilderBaseState,\n动态>#55a7d(生命周期状态:已创建))I/flutter ( 5919): 相关的导致错误的小部件是: I/flutter ( 5919): …

flutter bloc flutter-bloc

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

删除卡之间的空间

如何去除列之间的空间Card

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Sample"),
      ),
      body: Column(
        children: <Widget>[
          Card(
              child: Padding(
            padding: EdgeInsets.all(15),
            child: Text("Card 1"),
          )),
          Card(
            child: Padding(padding: EdgeInsets.all(15), child: Text("Card 2")),
          )
        ],
      ),
    );
  }
Run Code Online (Sandbox Code Playgroud)

输出

d

space dart flutter card

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

行太大,无法放入 CursorWindow requiredPos=0,totalRows=1;

我一直点击这个烦人的消息!

当数据完成插入本地数据库时,我看到了这条消息

JNI critical lock held for 30.083ms on Thread[27,tid=23883,Runnable,Thread*=0xce150a00,peer=0x12cc0190,"Sqflite"]
Run Code Online (Sandbox Code Playgroud)

如果我从表中选择数据,我会得到

W/CursorWindow(23809): Window is full: requested allocation 3095146 bytes, free space 2096696 bytes, window size 2097152 bytes
E/SQLiteQuery(23809): exception: Row too big to fit into CursorWindow requiredPos=0, totalRows=1; query: SELECT * FROM description_table;
I/flutter (23809): DatabaseException(Row too big to fit into CursorWindow requiredPos=0, totalRows=1) sql 'SELECT * FROM defect_description_table;' args []}
Run Code Online (Sandbox Code Playgroud)

我没有任何 blob 数据,都是字符串。那么为什么会发生这种情况呢?

这里是json结构

[{ "id": 1, "name": "Descriptions","data": [{..},{...} ... ]},{....},{....}]
Run Code Online (Sandbox Code Playgroud)

我认为问题出在数据列表上,因为它包含大量数据(有10298)?

解决这个问题的办法是什么?

我的插入方法

Future insertData(
      BuildContext context, …
Run Code Online (Sandbox Code Playgroud)

dart android-sqlite flutter flutter-moor

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

错误状态:意外诊断:flutter 升级到 1.20.1 后

问题是什么?

xxx@xxx-Inspiron-14-3467:~/xxx$ flutter pub run build_runner build[INFO] Generating build script...
[INFO] Generating build script completed, took 406ms

[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 14.6s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 773ms

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] chopper_generator:chopper_generator on …
Run Code Online (Sandbox Code Playgroud)

dart flutter chopper

3
推荐指数
2
解决办法
1472
查看次数

在网页视图中禁用深色模式

我正在 Flutter 中开发一个应用程序(带有 webview),当在设备上激活深色模式时,webview 会更改 web 的颜色(文本和背景)以使其变暗,从而产生可怕的结果。

有没有办法在网页视图中禁用暗模式?

我正在使用这个插件flutter_webview_plugin

web dart flutter darkmode

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

在导航控制器中杀死片段

我的片段流是这样的

Main -> A -> B -> C ->A
Run Code Online (Sandbox Code Playgroud)

在片段c中,它具有一个提交按钮,该按钮将返回到A。当我在A中按下后退按钮时,我希望它返回到Main。但是它返回片段c。

在片段C中,我使用了

 findNavController().navigate(R.id.action_c_to_a)
Run Code Online (Sandbox Code Playgroud)

nav_graph.xml

 <fragment
        android:id="@+id/fragmentC"
        android:name="xxx"
        android:label="xxx">
        <action
            app:launchSingleTop="true"
            app:popUpTo="@+id/fragmentA"
            app:popUpToInclusive="true"
            android:id="@+id/action_c_to_a"
            app:destination="@id/fragmentA" />
    </fragment>
Run Code Online (Sandbox Code Playgroud)

navigation android fragment navigationcontroller kotlin

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