我想CheckboxListTile在这个小部件对话框中构建一个复选框,但是当我点击复选框时,复选框checked上的复选框不会改变。
这是我的代码:
Future<Null> _showGroupDialog(BuildContext context) async {
await showDialog(
context: context,
builder: (BuildContext dialogContext) =>
Dialog(child: _buildCheckboxGroups(context)));
}
Widget _buildCheckboxGroups(BuildContext context) {
List<Widget> childrens = List.generate(_groups.length, (index) {
return CheckboxListTile(
title: Text(_groups[index].name),
value: _groups[index].checked,
onChanged: (bool val) {
setState(() {
_groups[index].checked = val;
});
},
);
});
return Container(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: childrens,
));
}
Run Code Online (Sandbox Code Playgroud)
顺便说一句,onChange当我点击复选框时会调用该方法。任何人都可以解决这个问题吗?
我只是想在 vuex 中创建动态注册模块,但它似乎不起作用。这是我的商店文件
import Vuex from 'vuex'
import descriptionModule from './module/descriptionModule';
const {state: stateModule, getters, mutations} = descriptionModule;
const createStore = () => {
return new Vuex.Store({
state: {
descriptions: [],
},
mutations: {
addDescriptions(state, payload){
state.descriptions.push(state.descriptions.length + 1);
createStore().registerModule(`descriptionModule${payload}`, {
state: stateModule,
getters,
mutations,
namespaced: true // making our module reusable
});
}
}
})
};
export default createStore
Run Code Online (Sandbox Code Playgroud)
这是我将注册的自定义模块
const state = () => {
return {description: ''}
};
const getters = {
description: (state) => state.description
}; …Run Code Online (Sandbox Code Playgroud) 我想通过lat和lng从灰烬组件到另一个组件的余烬(g-map).我的车把模板:
{{!-- Index.hbs --}}
<div class="jumbotron-outside">
<div class="jumbotron">
<h1 class="display-3">See The Weather Outside :)</h1>
<p class="lead">This is a simple forecast weather.</p>
<hr class="my-4">
<p>Just type everything bellow this input text to get all list of the city</p>
{{text-autocomplete}}
<p class="lead">
<button class="btn btn-primary btn-default" href="#" role="button" disabled={{isDisabled}}>Search</button>
</p>
</div>
{{g-map lat=lat lng=lng zoom=zoom}}
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的text-autocomplete组件:
// text-autocomplete/component.js
import Ember from 'ember';
let lat;
let lng;
export default Ember.Component.extend({
didInsertElement() { //dom can be acessed …Run Code Online (Sandbox Code Playgroud) javascript google-maps ember.js ember-controllers ember-components
我已经使用 react-native-map air bnb 在我的本机应用程序中渲染谷歌地图。地图和标记显示出来,但标记不能拖动。这是我的脚本
<View style={Style.mapContainer}>
<GeoLocation onSetInitalPos={this.onSetInitialPosition}
onSetLastPos={this.onSetLastPosition}/>
<MapView style={Style.map} region={this.state.region} onRegionChange={this.onRegionChange}>
<MapView.Marker draggable={this.state.draggable}
coordinate={this.state.marker.latlng}
title={this.state.marker.title}
description={this.state.marker.description}
onDrag={() => console.log('onDrag')}
/>
</MapView>
<AutoCompleteMap onSetNewPlace={this.setMarkerPosition}/>
</View>
Run Code Online (Sandbox Code Playgroud) javascript react-native react-native-android react-native-maps
javascript ×3
dart ×1
ember.js ×1
flutter ×1
google-maps ×1
react-native ×1
state ×1
vue.js ×1
vuejs2 ×1
vuex ×1