小编Sam*_*mer的帖子

Flutter 应用程序主体中的多行

我正在尝试在 flutter 中创建一个屏幕,该屏幕有 3 行堆叠在一起,但我不断收到语法错误。我在正文、Rows 等中尝试了多个容器并不断收到语法错误,我尝试做的事情是不可能的吗?我认为 Rows 是可堆叠的,或者至少是一个主体中的容器。

这是代码:

import 'package:flutter/material.dart';

class Index extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      appBar: new AppBar(
        backgroundColor: const Color(0xFF0099a9),
      ),
      body: Row(
        //ROW 1
        children: [
          Container(
            color: Colors.orange,
            margin: EdgeInsets.all(25.0),
            child: FlutterLogo(
              size: 60.0,
            ),
          ),
          Container(
            color: Colors.blue,
            margin: EdgeInsets.all(25.0),
            child: FlutterLogo(
              size: 60.0,
            ),
          ),
          Container(
            color: Colors.purple,
            margin: EdgeInsets.all(25.0),
            child: FlutterLogo(
              size: 60.0,
            ),
          ),
        ],
      ),
      Row(
        //ROW 2
        children: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

9
推荐指数
1
解决办法
3万
查看次数

在 Windows 10 上使用 VS Code 在 iPhone 上调试 flutter

是否可以使用 VS Code 在连接到 Windows 10 计算机的 iPhone 上以调试模式模拟 Flutter 应用程序?当我输入它时,这一切听起来都不起作用:)

iphone dart windows-10 flutter

6
推荐指数
1
解决办法
2471
查看次数

颤振中的三元运算符

我想基于布尔值显示和隐藏 HomeCategory 对象。我目前有这个:

  _isOn ? HomeCategory(0, Icons.check, Colors.blue[800], "Check In", [Task(0, "Check In", true),]) : "",
Run Code Online (Sandbox Code Playgroud)

但是它会引发错误,因为如果它关闭,我将传递一个空字符串。我如何向它传递一个空对象或隐藏它?这是一个像这样的列表:

   _isOn ? HomeCategory(0, Icons.check, Colors.blue[800], "Check In", [Task(0, "Check In", true),]) : "",
    HomeCategory(1, Icons.chat_bubble, Colors.red, "Forums", [ Task(1, "Questions", true),]),
    HomeCategory(2, Icons.star, Colors.blue[200], "Goals", [ Task(2, "Goals", true),]),
    HomeCategory(3, Icons.monetization_on, Colors.orange[700], "Budget", [ Task(3, "Budget", true),]),
    HomeCategory(4, Icons.shopping_basket, Colors.brown[300], "Shopping", [ Task(4, "Items", true),]),
    HomeCategory(5, Icons.calendar_today, Colors.purple[900], "My Day & Calendar", [ Task(4, "Events", false),]),
    HomeCategory(6, Icons.check_circle_outline, Colors.teal[700], "Check Out", [ Task(4, …
Run Code Online (Sandbox Code Playgroud)

dart flutter

6
推荐指数
1
解决办法
2万
查看次数

在没有实体框架的情况下使用ASP.NET Core Web API

我需要从没有实体框架的ASP.NET Core构建Web API。它是一个现有数据库,具有一些自定义存储过程,我们不希望使用EF。

我搜索了此主题,但找不到任何相关信息,这有可能吗?

asp.net-web-api2 asp.net-core

5
推荐指数
1
解决办法
7407
查看次数

Flutter 将对象传递给有状态的小部件

编辑 - 错误是用户未定义。

   class _CheckInState extends State<CheckIn> {

  double _value = 0;
  String _emotionalStatus = 'Happy';
  bool didStartDrag = false;
  double updatedDragDelta;
  bool didEndDrag = false;

  @override
 Widget build(BuildContext context) {
  return Scaffold(
      appBar: new LBAppBar().getAppBar(),
      drawer: new LBDrawer().getDrawer(),
  body:
  SwipeDetector(

   child:  Container(
    decoration: BoxDecoration(
        gradient: new LinearGradient(
            colors: [Color.fromRGBO(1,89,99, 1.0), Colors.grey],
            begin: Alignment.bottomLeft,
            end: Alignment.topRight
        )
    ),
    child: Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: <Widget>[

              Container(
                 margin: EdgeInsets.only(left: 30.0,top: 30.0, bottom: 70.0, right:30.0),
                 child :
               Text(

                'How are you …
Run Code Online (Sandbox Code Playgroud)

dart flutter

4
推荐指数
1
解决办法
7334
查看次数

在 List Tile Flutter 中的现有尾随旁边添加一个可点击的图标

我们想在ListTile. 这是代码。它是我们正在修改的基本购物清单屏幕,因此我们希望删除图标旁边有一个收藏夹图标。我尝试将其添加为副标题,但将其放在行的中间。我尝试为孩子添加一行,但它从屏幕上删除了购物项目。

import 'package:flutter/material.dart';
import 'package:lightbridge_mobile/models/shopping_item.dart';
import 'package:lightbridge_mobile/models/user.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;


class Shopping extends StatefulWidget {
 @override
_HomePageState createState() => _HomePageState();

final User user; 
Shopping({Key key, @required this.user}) : super(key: key);
}

class _HomePageState extends State<Shopping> {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState> 
  ();
final TextEditingController _textEditingController =
  TextEditingController();

List<ShoppingItem> items = [
ShoppingItem('Milk'),
ShoppingItem('Eggs'),
ShoppingItem('Fabric Softener'),
 ];

 void initState() {
 super.initState();

 }

 _onAddItemPressed() {
_scaffoldKey.currentState.showBottomSheet<Null>((BuildContext context) {
  return  Container(
    decoration:  BoxDecoration(color: …
Run Code Online (Sandbox Code Playgroud)

dart flutter

4
推荐指数
1
解决办法
6097
查看次数

HTTP call on screen load in flutter

We have a Features class that we are trying to fill when a screen loads. Its an http call that returns the object. Im struggling with how to do this. All of our http calls are done on a button click:

here is the call

      Future<Features> getFeatureStatus(String userID) async {

      Features _features;

     final response =
     await http.post('http://url/api/Features',
     headers: {"Content-Type": "application/json", 
             'Accept': 'application/json',},
  body: json.encode({'userID' : userID }));

 _features = Features.fromJson(json.decode(response.body));

   return _features;


  } 
Run Code Online (Sandbox Code Playgroud)

When i try to call it at …

dart flutter

4
推荐指数
1
解决办法
8761
查看次数

在颤动中更改标签栏的背景颜色

我正在尝试更改颤振中选项卡栏的背景颜色,我尝试了以下方法(在本论坛上被接受为答案),但没有奏效:

这是代码

   return new MaterialApp(
      theme: new ThemeData(
      brightness: Brightness.light,
      primaryColor: Colors.pink[800], //Changing this will change the color of  the TabBar
      accentColor: Colors.cyan[600],
    ),
Run Code Online (Sandbox Code Playgroud)

编辑 :

当我更改主题数据颜色时,背景颜色不会改变。我试图在应用栏下方创建一个水平滚动子菜单,有人建议我使用 Tab 栏。

这是整个 dart 文件:

  import 'package:flutter/material.dart';
  import 'package:font_awesome_flutter/font_awesome_flutter.dart';

  class Index extends StatelessWidget {

//final User user;

  // HomeScreen({Key key, @required this.user}) : super(key: key);

  @override
   Widget build(BuildContext context) {
     // TODO: implement build
    // String emoji = emojify(":cool:");
   return new MaterialApp(
     theme: new ThemeData(
      brightness: Brightness.light,
       primaryColor: Colors.white, //Changing this will change …
Run Code Online (Sandbox Code Playgroud)

dart flutter

3
推荐指数
1
解决办法
1万
查看次数

检测在颤动中向右滑动

香港专业教育学院尝试使用swipedetector插件进行颤动,以实现向右滑动的新屏幕的导航,但无法正常工作,不会引发任何错误,并且在调试时永远不会碰到断点。我查看了GestureDector,但不确定是否可以在向右滑动的Scenerio中使用它,我们希望在向右滑动屏幕时可以将其导航到屏幕。

这是我使用插件的代码

 @override
 Widget build(BuildContext context){
return new Scaffold(
 appBar : LBAppBar().getAppBar(),
  //drawer: new LBDrawer().getDrawer(),
 body:  Container(
decoration: BoxDecoration(
    gradient: new LinearGradient(
        colors: [Color.fromRGBO(1,89,99, 1.0), Colors.grey],
        begin: Alignment.bottomLeft,
        end: Alignment.topRight
    )
),
 child: 
 SwipeDetector(
     onSwipeRight: () {
       Navigator.of(context).push(new MaterialPageRoute(builder: (BuildContext context) => new WidgetsPage())
        ); },
  child: Column(
  mainAxisAlignment: MainAxisAlignment.center,    
  children:[
    Row(
            children: [
          Container(
            margin: EdgeInsets.only(left: 20.0,top: 10.0, bottom: 10.0, right:30.0),
            child: Column(
  children: <Widget>[



            Text("Hi ${user.firstName}, Today is " + formatDate(), style: new TextStyle( color: Colors.white70, fontWeight: FontWeight.bold, …
Run Code Online (Sandbox Code Playgroud)

dart flutter

3
推荐指数
7
解决办法
2784
查看次数

打开视频通话抖动

有没有办法在flutter中打开原生手机上的视频通话功能?我看过 Agora 和其他人,但没有一个像我们需要的那样工作。

dart flutter

2
推荐指数
1
解决办法
3504
查看次数