inaccentColor已ThemeData被弃用。
那么用在什么地方呢ThemeData?
theme: ThemeData(
brightness: Brightness.light,
primaryColor: kBaseColor,
accentColor: kBaseAccentColor, // 'accentColor' is deprecated and shouldn't be used
Run Code Online (Sandbox Code Playgroud) print何时使用and存在一些混乱debugPrint,因此有些陈述可能是错误的,应该澄清:
当使用直接print方法时,它会给生产带来很多垃圾,不是吗?
使用该debugPrint方法时,它只会在开发时打印,还是也会在生产中打印?
当我生成release文件(apk)时,不会删除所有print优化应用程序的调用并减少release文件大小吗?
什么是默认的请求方法类型@RequestMapping?
@RequestMapping(value = "addGoal")
public String addGoal(Model model) {...}
Run Code Online (Sandbox Code Playgroud) ButtonStyle 中的 MaterialStateProperty 是什么?
ThemeData(
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
backgroundColor: , //?
),
),
),
Run Code Online (Sandbox Code Playgroud) 它似乎@RequiredArgsConstructor不适用于下面的代码.为什么?
import java.io.Serializable;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@Data
@RequiredArgsConstructor
public class User implements Serializable {
private String username;
/*public User(String username) {
this.username = username;
}*/
private static final long serialVersionUID = 8043545738660721361L;
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
javax.faces.el.EvaluationException: java.lang.Error: Unresolved compilation problem:
The constructor User(String) is undefined
Run Code Online (Sandbox Code Playgroud)
出于某种原因,它似乎适用于其他没有构造函数定义但是使用@RequiredArgsConstructor注释的域类.
当请求映射中存在双星号时,这意味着什么?例如
@RequestMapping(value = { "/", "/welcome**" }, method =
RequestMethod.GET) public ModelAndView welcomePage() { ...
Run Code Online (Sandbox Code Playgroud) 除了不可滚动之外,此小部件呈现没有错误
SingleChildScrollView(
child: Column(
children: <Widget>[
ListView(
shrinkWrap: true,
children: <Widget>[
ListTile(
title: Row(
children: const <Widget>[
Expanded(child: Text('text'),),
Expanded(child: Text('text'),),
],
),
),
],
),
RapportList(), // this is not scrollable
],
),
),
Run Code Online (Sandbox Code Playgroud)
哪里RapportList()是一个有状态的小部件,它构建了一个
ListView.builder(
shrinkWrap: true,
itemCount: _rapports.length,
itemBuilder: (context, index) {
return ListTile(
title: Row(
children: <Widget>[
...
Run Code Online (Sandbox Code Playgroud)
我试图ListView.builder用SingleChildScrollViewwith包裹但没有结果。它仍然不可滚动。
例如,有一个示例颤振代码。此代码格式不正确。
import 'package:flutter/material.dart';
void main() => runApp(SampleApp());
class SampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: SafeArea(
child: Container(
child: const Text('123'),), // this line isn't properly formatted
),
),
);
}
}
Run Code Online (Sandbox Code Playgroud)
我听说当代码保存在编辑器中时,Android Studio 能够自动格式化颤动代码。在这种情况下,必须遵守某些条件, - 所有逗号都应该出现在代码中,就像在上面的示例代码中一样。但我没有找到如何做到这一点。因此,如果这是真的(即如果有可能做到这一点)如何实现呢?
int _selectedIndex = 0; - 这个状态类中定义了一个变量,为什么会出现错误?
Compiler message:
lib/rappport_list.dart:139:29: Error: Not a constant expression.
_selectedIndex == index ? Colors.red : Colors.cyan,
^^^^^^^^^^^^^^
lib/rappport_list.dart:139:47: Error: Not a constant expression.
_selectedIndex == index ? Colors.red : Colors.cyan,
^^^^^
Run Code Online (Sandbox Code Playgroud) 我收到错误:
更喜欢_const_literals_to_create_immutables
在此小部件上:
child: Column(
children: <Widget>[
Hyperlink('https://t.me/egorka', 'chat with me'),
],
),
Run Code Online (Sandbox Code Playgroud)
其中 Hyperlink 类定义如下:
class Hyperlink extends StatelessWidget {
const Hyperlink(this._url, this._text);
final String _url;
final String _text;
Run Code Online (Sandbox Code Playgroud)
我不知道如何更改代码来摆脱它?