当我使用flutter create命令创建应用程序时,flutter徽标将用作两个平台的应用程序图标.
如果我想更改应用程序图标,我是否应该转到两个平台目录并在那里替换图像?平台目录我的意思 myapp/ios/Runner/Assets.xcassets/AppIcon.appiconset是iOS和myapp/android/app/src/main/resAndroid.
或者是否可以将图像定义为Flutter资产,并以某种方式生成图标?
android studio在构建执行时出现构建错误,其中包含以下"错误:执行任务失败":app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException:java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex"
我的app:build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.pdroid.foodieschoice"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.firebaseui:firebase-ui-auth:2.3.0'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy {
force 'com.android.support:appcompat-v7:26.0.1'
force 'com.android.support:support-compat:26.0.1'
force 'com.android.support:support-core-ui:26.0.1'
force 'com.android.support:support-annotations:26.0.1'
force 'com.android.support:recyclerview-v7:26.0.1'
}
}
apply plugin: …Run Code Online (Sandbox Code Playgroud) 我试图显示当前DateTime的Text按钮后丝锥.目前它的工作原理,但我想改变格式
我用
DateTime now = DateTime.now();
currentTime = new DateTime(now.year, now.month, now.day, now.hour, now.minute);
Run Code Online (Sandbox Code Playgroud)
Text('$currentTime'),
Run Code Online (Sandbox Code Playgroud)
结果是:YYYY-MM-JJ HH-MM:00.000
我不知道如何删除":00.000"
他们似乎都可以在相同的情况下使用它们.在类型检查等方面是否有不同的表示或不同的细微之处?
我希望环境变量有不同的配置文件,并且能够在我的下一个项目中使用它们。我看到了dotenv的例子。
但我不喜欢在 .env 文件中定义变量,也不想在 config.next.js 文件中定义它们。如果由于某种原因我将变量放在 .env 文件中但忘记将它们放在 config.next.js 文件中,则代码开始出现问题。有没有办法更有效地做到这一点?
我在 package.json 中的脚本:
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"lint": "eslint pages --ext .ts,.tsx,.js",
"test": "jest",
"commit": "git-cz",
"dev:production": "dotenv next"
},
Run Code Online (Sandbox Code Playgroud)
我的 .env 变量
TITULO=react, typescript, material ui App
Run Code Online (Sandbox Code Playgroud)
成分
import { NextPage } from 'next';
import { FunctionComponent } from 'react';
interface HelloWorldProps {
nombre: string,
saludo?: string
}
const HelloWorld: FunctionComponent<HelloWorldProps> = ({ nombre, saludo = 'noches' }: HelloWorldProps) => ( …Run Code Online (Sandbox Code Playgroud) 如何更改材质按钮的字体大小...有更好的方法吗?
new MaterialButton(
height: 140.0,
minWidth: double.infinity,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
child: new Text("material button"),
onPressed: () => {},
splashColor: Colors.redAccent,
),
Run Code Online (Sandbox Code Playgroud) 根据此处发布的更改,Android R 及以后不推荐使用 getNetworkType 方法。
在 R 编译的应用程序中尝试使用此方法时,会导致抛出以下异常:
java.lang.SecurityException: getDataNetworkTypeForSubscriber: uid 10225 does not have android.permission.READ_PHONE_STATE.
at android.os.Parcel.createExceptionOrNull(Parcel.java:2285)
at android.os.Parcel.createException(Parcel.java:2269)
at android.os.Parcel.readException(Parcel.java:2252)
at android.os.Parcel.readException(Parcel.java:2194)
at com.android.internal.telephony.ITelephony$Stub$Proxy.getNetworkTypeForSubscriber(ITelephony.java:7565)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2964)
at android.telephony.TelephonyManager.getNetworkType(TelephonyManager.java:2928)
at com.ironsource.environment.ConnectivityService.getCellularNetworkType(ConnectivityService.java:197)
at com.ironsource.sdk.service.DeviceData.updateWithConnectionInfo(DeviceData.java:98)
at com.ironsource.sdk.service.DeviceData.fetchMutableData(DeviceData.java:54)
at com.ironsource.sdk.service.TokenService.collectDataFromDevice(TokenService.java:120)
at com.ironsource.sdk.service.TokenService.getRawToken(TokenService.java:177)
at com.ironsource.sdk.service.TokenService.getToken(TokenService.java:166)
at com.ironsource.sdk.IronSourceNetwork.getToken(IronSourceNetwork.java:183)
Run Code Online (Sandbox Code Playgroud)
这很好,根据文档是预期的。如果我将应用程序编译为 Android R 之前的任何版本,则不会显示异常。
此异常表示我需要请求android.permission.READ_PHONE_STATE权限。
我想知道是否有办法使用不需要此权限的任何其他 API 获取网络类型(因为此权限的级别很危险,我宁愿不要求用户提供)。
我只是在Flutter中创建一个表单.我无法设置按钮的上边距.
class _MyHomePageState extends State<MyHomePage> {
String firstname;
String lastname;
final scaffoldKey = new GlobalKey<ScaffoldState>();
final formKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return new Scaffold(
key: scaffoldKey,
appBar: new AppBar(
title: new Text('Validating forms'),
),
body: new Padding(
padding: const EdgeInsets.all(16.0),
child: new Form(
key: formKey,
child: new Column(
children: [
new TextFormField(
decoration: new InputDecoration(labelText: 'First Name'),
validator: (val) =>
val.length == 0 ?"Enter FirstName" : null,
onSaved: (val) => firstname = val,
),
new TextFormField( …Run Code Online (Sandbox Code Playgroud) 我正在使用PBEWITHSHA256AND256BITAES-CBC-BC来加密包含敏感用户数据的二进制数据
我只想确认BouncyCastle是否属于(2.1)之后的每个Android SDK,因为我在一些网站上看到BouncyCastle不是每个Android SDK的一部分.
想要一个明确的答案
您好,我正在尝试从其他集团中收听集团的状态。我正在使用这个包https://pub.dev/packages/bloc
从我的UserBloc我想听AuthBloc,当它具有AuthenticationAuthenticated状态时,UserBloc应该触发一个事件。
final UserRepository userRepository;
final authBloc;
StreamSubscription authSub;
UserBloc({ @required this.userRepository, @required this.authBloc}) {
authSub = authBloc.listen((stateAuth) {
//here is my problem because stateAuth, even is AuthenticationAuthenticated it return always false.
if (stateAuth is AuthenticationAuthenticated) {
this.add(GetUser()) ;
}
});
}
@override
Future<void> close() async {
authSub?.cancel();
super.close();
}
Run Code Online (Sandbox Code Playgroud)
现在我有这个问题:在调试时我试图打印 stateAuth 它返回:
stateAuth = {AuthenticationAuthenticated} AuthenticationAuthenticated
props = {_ImmutableList} size = 0
Run Code Online (Sandbox Code Playgroud)
但是stateAuth 是 AuthenticationAuthenticated返回始终为 false。
有没有办法从其他 Bloc …
flutter ×5
android ×2
button ×2
dart ×2
android-11 ×1
bouncycastle ×1
build-error ×1
datetime ×1
dynamictype ×1
encryption ×1
flutter-bloc ×1
margin ×1
next.js ×1
object ×1
reactjs ×1
text-size ×1