簡體   English   中英

flutter pubspec.yaml 在運行時顯示錯誤

[英]flutter pubspec.yaml showing error in run time

我正在嘗試運行此 flutter 代碼,我不知道出了什么問題我已經更新了 pubspect.yaml

import 'package:flutter/material.dart';

class NameCapitalize extends StatelessWidget {
  const NameCapitalize({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
      body: SizedBox(
        height: double.infinity,
        width: double.infinity,
        
        child: Stack(
          //Widget i make like a table and split the screen into rows and columns
          children: [
            Column(
              children:[
                Text("Hi Their!")
                svgPicture.asset('assets/icons/chat.svg')
              ],
            ),
            //Widget i move by using left and right top and bottom commands
        Positioned(
          child: Image.asset("assets/images/main_top.png"),
          //child hear is a picture use to decorate app page
        ),
        Positioned(
          bottom: 0,
          child: Image.asset("assets/images/main_bottom.png"),
          //child hear is a picture use to decorate app page
        ),
       ),
      ),
    ),
    );
  }
}

----- end of code ----

這里的錯誤:


Error on line 64, column 6: Expected a key while parsing a block mapping.
   ╷
64 │      - assets/images/
   │      ^
   ╵
Please correct the pubspec.yaml file at /Users/adelalshehri/StudioProjects/Flutter_Final_Project_Level1/pubspec.yaml

您需要在資產圖像之前有適當的間距,就像

flutter:
  uses-material-design: true

  assets:
    - assets/file.xml
    - assets/alice.png
    - assets/Sukuna.jpg

主要assets:前面有兩個空格,黃色

里面的圖像包含4個空格,標記為紅色

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM