bash: flutter: command not found
Run Code Online (Sandbox Code Playgroud)
嗨,大家好!显然没有扑命令正在Android的工作室,我相信,我想我的项目的根目录运行它的终端上.先感谢您
通过使用这个:
Text(new DateTime.fromMillisecondsSinceEpoch(values[index]["start_time"]*1000).toString(),
Run Code Online (Sandbox Code Playgroud)
我正在获得图片中附加的格式类型,但我想知道我是否可以获得它dd/MM/YYYY hh:mm?
var userDetails = {};
var i;
List returnTicketDetails = [] ;
body: new Column(
children: <Widget>[
new Container(
color: Theme.of(context).primaryColor,
child: new Padding(
padding: const EdgeInsets.all(8.0),
child: new Card(
child: new ListTile(
leading: new Icon(Icons.search),
title: new TextField(
controller: controller,
decoration: new InputDecoration(
hintText: 'Search', border: InputBorder.none),
// onChanged: onSearchTextChanged,
),
trailing: new IconButton(icon: new Icon(Icons.cancel), onPressed: () {
controller.clear();
// onSearchTextChanged('');
},),
),
new Expanded(
child: userDetails.length != 0 || controller.text.isNotEmpty
? new ListView.builder(
itemCount: userDetails.length,
itemBuilder: (context, i) …Run Code Online (Sandbox Code Playgroud) List returnMovies = [];
Future<List> _getData() async {
final response = await http.get("https:../getTodayMovies",
headers: {HttpHeaders.AUTHORIZATION: Acess_Token.access_token});
if (response.body != null) {
returnMovies = json.decode(response.body);
.....
setState(() {});
} else {
final responseUpcoming = await http.get("/upcoming",
headers: {HttpHeaders.AUTHORIZATION: Acess_Token.access_token});
returnMovies = json.decode(responseUpcoming.body);
}
Run Code Online (Sandbox Code Playgroud)
response.body 看起来像:
[{"id":394470548,"host_group_name":"heyab redda","movie_image":"..png","type":"horror","code":"X123","name":"Lovely","start_time":1554364800,"end_time":1554393600,"}]
Run Code Online (Sandbox Code Playgroud)
responseUpcoming.body 看起来像:
{"id":394470545,"host_group_name":"foo redda","movie_image":".png","type":"horror","code":"X123","name":"Lovely","start_time":1554364800,"end_time":1554393600,"}, {"id":394470548,"host_group_name":"foo1 redda","movie_image":"..png","type":"comic","code":"X125","name":"Lovely1","start_time":1554364800,"end_time":1554393600,"}
Run Code Online (Sandbox Code Playgroud)
我得到的错误是: String, dynamic is not a subtype of type List<dynamic>。
在我执行的第一个 API 调用中,我通常会返回一个对象数组,但是,当它为空时,第二个 API 调用会返回一个我想推入名为 returnMovies 的数组中的对象列表,我该如何实现这个??有没有办法将这些对象推送到数组中??那么我想使用这个数组来动态构建一个 Listview.builder。我声明的方式是否正确?我对 Dart 很陌生。谢谢
@override
Widget build(BuildContext context) {
widget.groupid;
widget.event_id;
var futureBuilder = new FutureBuilder(
future: _getAllTickets(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
print(snapshot.connectionState);
switch (snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return new Text('...');
default:
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
else
return createListTickets(context, snapshot);
}
},
);
return new Scaffold(
body: futureBuilder,
);
}
Widget createListTickets(BuildContext context, AsyncSnapshot snapshot) {
List values = snapshot.data;
child: new Card(
child:
new Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
new Text(
values[index]["ticket_type_id"].toString(), style:
const TextStyle(
fontFamily: 'Poppins',
fontWeight: …Run Code Online (Sandbox Code Playgroud) 每当我从终端运行以下命令:flutter在ios的项目根目录中构建ios时,我都会得到回报:
找不到“ xcodebuild”。为iOS开发,需要Xcode 9.0或更高版本。
为设备构建时遇到错误。我拥有最新的Xcode(版本10.0)。
扑医生:
[?] Flutter (Channel beta, v0.8.2, on Mac OS X 10.13.6 17G65, locale en-GB)
• Flutter version 0.8.2 at /Users/h/flutter
• Framework revision 5ab9e70727 (2 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[?] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/h/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, …Run Code Online (Sandbox Code Playgroud) 在应用程序启动时,我收到此错误:SocketException: Failed host lookup: '..co' (OS Error: nodename or servname provided, or not known, errno = 8)
另外我的 flutter docotor -v 输出是:
Heyabs-MacBook-Pro:flutterLoginApp-master4OK heyab$ flutter doctor -v
[?] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G65, locale en-GB)
• Flutter version 1.0.0 at /Users/heyab/flutter
• Framework revision 5391447fae (3 months ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[?] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android …Run Code Online (Sandbox Code Playgroud) 我正在对组件进行一些单元测试。但是,在某些组件中,我有一些运行在mounted钩子上的东西使我的测试失败。我设法模拟了我不需要的方法。但是,我想知道是否有一种解决方法来模拟mounted钩子本身。
@/components/attendeesList.vue
<template>
<div>
<span> This is a test </span>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
JS
<script>
methods: {
testMethod: function() {
// Whatever is in here I have managed to mock it
}
},
mounted: {
this.testMethod();
}
</script>
Run Code Online (Sandbox Code Playgroud)
测试规范.js
import { mount, shallowMount } from '@vue/test-utils'
import test from '@/components/attendeesList.vue'
describe('mocks a method', () => {
test('is a Vue instance', () => {
const wrapper = shallowMount(attendeesList, {
testMethod:jest.fn(),
})
expect(wrapper.isVueInstance()).toBeTruthy()
})
Run Code Online (Sandbox Code Playgroud) 每当我运行flutter构建IOS时,它似乎工作正常,但是当它达到"构建Dart代码"时,它就会永远卡在那里.然而,我之前能够成功运行flutter build apk.
这是颤动的医生-v输出:
[?] Flutter (Channel beta, v0.11.3, on Mac OS X 10.13.6 17G65, locale en-GB)
• Flutter version 0.11.3 at /Users/../flutter
• Framework revision 72bf075e8d (4 days ago), 2018-11-09 20:36:17 -0800
• Engine revision 5646e86a6f
• Dart version 2.1.0 (build 2.1.0-dev.9.3 9c07fb64c4)
[?] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/../Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary …Run Code Online (Sandbox Code Playgroud) new Expanded(
child: _searchResult.length != 0 || controller.text.isNotEmpty
? new ListView.builder(
itemCount: _searchResult.length,
itemBuilder: (context, int i) {
return new Card(
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Row(children: <Widget>[
//new GestureDetector(),
new Container(
width: 45.0,
height: 45.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new NetworkImage(
"https://raw.githubusercontent.com/flutter/website/master/_includes/code/layout/lakes/images/lake.jpg")))),
new Text(
" " +
userDetails[returnTicketDetails[i]
["user_id"]]["first_name"] +
" " +
(userDetails[returnTicketDetails[i]
["user_id"]]["last_name"]),
style: const TextStyle(
fontFamily: 'Poppins', fontSize: 20.0)),
]),
new Column(
children: <Widget>[
new Align( …Run Code Online (Sandbox Code Playgroud) new Container(
width: 80.0,
height: 80.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new NetworkImage(widget.profile_picture)))),
Run Code Online (Sandbox Code Playgroud)
目前,我有一个NetworkImage,但是我希望有一个圆形的CachedNetworkImage。
class Tickets extends StatefulWidget {
int groupid;
int event_id;
Tickets([this.groupid, this.event_id]);
@override
_TicketsState createState() => new _TicketsState();
}
List<Widget> ListMyWidgets(ticketGroups) {
IconData icon = Icons.undo;
List<Widget> list = new List();
list.add(new CupertinoNavigationBar(
backgroundColor: Colors.blue,
leading:
new Padding(
padding: new EdgeInsets.all(8.0),
child: new Text(ticketGroups[0]['ticket_name'],
style: const TextStyle(
fontSize: 20.0, fontFamily: 'Poppins', color: Colors.white)),
),
trailing: new Padding(
padding: new EdgeInsets.all(8.0),
child: new Text('${ticketGroups.length}',
style: const TextStyle(
fontSize: 20.0, fontFamily: 'Poppins', color: Colors.white))),
));
for (int i = 0; i < ticketGroups.length; …Run Code Online (Sandbox Code Playgroud)