以下是我尝试添加带有装饰的表单 TextFormField 的代码,如模拟所示:
嘲笑:
代码:
class MyCustomFormState extends State<MyCustomForm> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
// Build a Form widget using the _formKey created above.
return Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
TextFormField(
decoration: InputDecoration(
fillColor: Colors.grey,
focusColor: Colors.grey
),
validator: (value) {
if (value.isEmpty) {
return 'Your email';
}
return null;
},
),
TextFormField(
decoration: InputDecoration(
fillColor: Colors.grey,
focusColor: Colors.grey
),
validator: (value) {
if (value.isEmpty) { …
Run Code Online (Sandbox Code Playgroud) 我无法在 android studio 中运行我的 flutter 应用程序。我正在使用 firebase 登录并注册用户。因此,相应地,我添加了该google-services.json
文件。
需要注意的是,我的代码确实在使用 ios 模拟器的 vs-code 中得到了渲染。
以下是我的android/build.gradle
文件:
buildscript {
ext.kotlin_version = '1.3.70'
repositories {
google()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
现在以下是我的android/app/build.gradle
文件:
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) …
Run Code Online (Sandbox Code Playgroud) 因此,我使用 API 来获取数据,它响应一个包含印地语字符的字符串。但是当我打印时response.body
它显示如下(乱码)
现在我的模拟器屏幕上显示了相同的内容,但如果我复制粘贴印地语文本并渲染,那么它就可以工作:
\n\n\n\n两种场景的代码片段,即来自 API 响应的标题数据和正文中相同的字符串复制粘贴(并按预期工作):
\n\nListTile(\n dense: true,\n contentPadding: EdgeInsets.all(0),\n title: Text(\n data[\'testVersion\'][\'name\'] != null\n ? data[\'testVersion\'][\'name\']\n : \'NA\',\n style: TextStyle(\n fontFamily: \'NatoSansDevnagri\',\n fontWeight: FontWeight.w700,\n fontSize: 18,\n color: Colors.black),\n ),\n trailing: Text(data[\'testVersion\'][\'time\'] != null\n ? data[\'testVersion\'][\'time\']\n : \'NA\'),\n ),\n Text(\'Below string is copy pasted in text widget from swagger response\'),\n Text(\n ( \'\xe0\xa4\x87\xe0\xa4\xb8 \xe0\xa4\xaa\xe0\xa5\x87\xe0\xa4\xaa\xe0\xa4\xb0 \xe0\xa4\xae\xe0\xa5\x87\xe0\xa4\x82 150 \xe0\xa4\xb5\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\xa4\xe0\xa5\x81\xe0\xa4\xa8\xe0\xa4\xbf\xe0\xa4\xb7\xe0\xa5\x8d\xe0\xa4\xa0 \xe0\xa4\xac\xe0\xa4\xb9\xe0\xa5\x81\xe0\xa4\xb5\xe0\xa4\xbf\xe0\xa4\x95\xe0\xa4\xb2\xe0\xa5\x8d\xe0\xa4\xaa\xe0\xa5\x80\xe0\xa4\xaf \xe0\xa4\xaa\xe0\xa5\x8d\xe0\xa4\xb0\xe0\xa4\xb6\xe0\xa5\x8d\xe0\xa4\xa8 \xe0\xa4\xb9\xe0\xa5\x88\xe0\xa4\x82\xe0\xa5\xa4 \xe0\xa4\xaf\xe0\xa4\xb9 \xe0\xa4\xaa\xe0\xa5\x8d\xe0\xa4\xb0\xe0\xa4\xb6\xe0\xa5\x8d\xe0\xa4\xa8 \xe0\xa4\xaa\xe0\xa5\x81\xe0\xa4\xb8\xe0\xa5\x8d\xe0\xa4\xa4\xe0\xa4\xbf\xe0\xa4\x95\xe0\xa4\xbe \xe0\xa4\xa8\xe0\xa4\xbf\xe0\xa4\xae\xe0\xa5\x8d\xe0\xa4\xa8\xe0\xa4\xb2\xe0\xa4\xbf\xe0\xa4\x96\xe0\xa4\xbf\xe0\xa4\xa4 \xe0\xa4\xaa\xe0\xa4\xbe\xe0\xa4\x82\xe0\xa4\x9a \xe0\xa4\x96\xe0\xa4\x82\xe0\xa4\xa1\xe0\xa5\x8b\xe0\xa4\x82 \xe0\xa4\xb8\xe0\xa5\x87 \xe0\xa4\xac\xe0\xa4\xa8\xe0\xa5\x80 \xe0\xa4\xb9\xe0\xa5\x88: \xe0\xa4\xa7\xe0\xa4\xbe\xe0\xa4\xb0\xe0\xa4\xbe- I, …
Run Code Online (Sandbox Code Playgroud) 所以,一直在尝试在 reactjs 中使用数据表,我想在列中放置一个 onclick 但出现错误。
以下是我的代码:
const $ = require('jquery')
$.DataTable = require('datatables.net')
class Rmsdatatable extends Component {
constructor(props) {
super(props)
this.handletableclick = this.handletableclick.bind(this)
}
handletableclick(event) {
console.log(event)
}
componentDidUpdate() {
console.log(this.props.data)
this.$el = $(this.el)
this.$el.DataTable(
{
data: this.props.data,
scrollY: 520,
paging: false,
responsive: true,
columns: [
{
data: "vfdSno",
render: function (data, type, row) {
return '<a onClick={' + this.handletableclick.bind(this, row) + '} >' + data + '</a>'
}
},
{ data: "customerName" },
{ data: "district" },
{ …
Run Code Online (Sandbox Code Playgroud)