Nom*_*san 4 dart flutter flutter-dependencies
**我在运行时遇到错误,错误是因为包或其他原因,我已删除所有旧代码并添加新代码,但仍面临以下错误。
\n错误:“NavigationBar”是从“package:flutter/src/material/navigation_bar.dart”和“package:flutter_onboarding_slider/navigation_bar.dart”导入的。\nappBar: NavigationBar(\n^^^^^^^^^^ ^^^\n: 警告:空感知操作“?.”的操作数的类型为“GoogleMapController”,不包括空值。\nlib/\xe2\x80\xa6/map/map.dart:62
\n“GoogleMapController”来自“package:google_maps_flutter/google_maps_flutter.dart”(“/D:/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_flutter-2.1.7/lib/google_maps_flutter.dart”)。\ npackage:google_maps_flutter/google_maps_flutter.dart:1\n_controller?.animateCamera(CameraUpdate.newCameraPosition(CameraPosition(\n^
\n导入 'package:flutter/cupertino.dart';\n导入 'package:flutter/material.dart';\n导入 'package:flutter_onboarding_slider/flutter_onboarding_slider.dart';\n导入 'package:fyppedometer/mainScreens/Navigation/navigationBar.dart' ;\n导入 'package:fyppedometer/widgets/constants.dart';\n导入 'package:fyppedometer/widgets/text.dart';
\nclass MyHome 扩展 StatefulWidget {\nconst MyHome({Key? key}) : super(key: key);
\n@override\nState<MyHome> createState() => _MyHomeState();\nRun Code Online (Sandbox Code Playgroud)\n}
\nclass _MyHomeState extends State {\n最终颜色 kDarkBlueColor = Colors.cyan;
\n// ignore: non_constant_identifier_names\n\nList<String> numbers_Height = [\n for (var i = 1.1; i <= 10.0; i = i + 0.1) i.toString()\n];\n// ignore: non_constant_identifier_names\nList<String> numbers_Weight = [for (var i = 1; i <= 1000; i++) i.toString()];\n\nint _groupValue = -1;\nString _selectedGender = 'male';\n\n@override\nWidget build(BuildContext context) {\n Size size = MediaQuery.of(context).size;\n\n return Container(\n // color: Colors.amber,\n child: OnBoardingSlider(\n buttonText: 'Start',\n onFinish: () {\n Navigator.push(\n context,\n CupertinoPageRoute(\n builder: (context) => Navbar(),\n ),\n );\n },\n buttonTextColor: Colors.cyan,\n\n // skipTextButton: Text(\n // 'Skip',\n // style: TextStyle(\n // fontSize: 16,\n // color: kDarkBlueColor,\n // fontWeight: FontWeight.w600,\n // ),\n // ),\n // trailing: Text(\n // 'Login',\n // style: TextStyle(\n // fontSize: 16,\n // color: kDarkBlueColor,\n // fontWeight: FontWeight.w600,\n // ),\n // ),\n // trailingFunction: () {\n // // Navigator.push(\n // // context,\n // // CupertinoPageRoute(\n // // builder: (context) => LoginPage(),\n // // ),\n // // );\n // },\n\n controllerColor: kDarkBlueColor,\n totalPage: 3,\n headerBackgroundColor: liteblue,\n pageBackgroundColor: liteblue,\n background: [\n Padding(\n padding: const EdgeInsets.only(top: 210, left: 80),\n child: Image.asset(\n 'assets/gender.png',\n height: MediaQuery.of(context).size.height * 0.6,\n width: MediaQuery.of(context).size.width * 0.6,\n ),\n ),\n Padding(\n padding: const EdgeInsets.only(top: 160, left: 60),\n child: Image.asset(\n 'assets/walking.png',\n height: MediaQuery.of(context).size.height * 0.7,\n width: MediaQuery.of(context).size.width * 0.7,\n ),\n ),\n Padding(\n padding: const EdgeInsets.only(top: 200, left: 60),\n child: Image.asset(\n 'assets/human.png',\n height: MediaQuery.of(context).size.height * 0.6,\n width: MediaQuery.of(context).size.width * 0.6,\n ),\n ),\n ],\n speed: 1.8,\n pageBodies: [\n Container(\n // padding: EdgeInsets.symmetric(horizontal: 40),\n child: Column(\n mainAxisAlignment: MainAxisAlignment.start,\n crossAxisAlignment: CrossAxisAlignment.center,\n children: <Widget>[\n const Text(\n 'What\xe2\x80\x99s Your Gender',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white,\n fontSize: 24.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 10,\n ),\n const Text(\n 'Calories & Stride length calculation need it ',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white60,\n fontSize: 21.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 20,\n ),\n Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: [\n Container(\n height: size.height * 0.1,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius:\n BorderRadius.circular(25), // radius of 10\n color: Color.fromARGB(255, 19, 65, 103),\n ),\n child: Center(\n child: ListTile(\n leading: Radio<String>(\n activeColor: Colors.white,\n value: 'male',\n groupValue: _selectedGender,\n onChanged: (value) {\n setState(() {\n _selectedGender = value!;\n });\n },\n ),\n title: text(\n textData: "Male",\n color: Colors.white,\n fontsize: 20.0,\n fontweight: FontWeight.bold),\n\n // Text(_selectedGender == 'male' ? 'Hello gentlement!' : 'Hi lady!')\n ),\n ),\n ),\n SizedBox(height: 20),\n Container(\n height: size.height * 0.1,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius:\n BorderRadius.circular(25), // radius of 10\n color: Color.fromARGB(255, 19, 65, 103),\n ),\n child: Center(\n child: ListTile(\n leading: Radio<String>(\n activeColor: Colors.white,\n value: 'female',\n groupValue: _selectedGender,\n onChanged: (value) {\n setState(() {\n _selectedGender = value!;\n });\n },\n ),\n title: text(\n textData: "Female",\n color: Colors.white,\n fontsize: 20.0,\n fontweight: FontWeight.bold),\n // Text(_selectedGender == 'male' ? 'Hello gentlement!' : 'Hi lady!')\n ),\n ),\n ),\n ],\n )\n ]),\n ),\n Container(\n // padding: EdgeInsets.symmetric(horizontal: 40),\n child: Column(\n mainAxisAlignment: MainAxisAlignment.start,\n crossAxisAlignment: CrossAxisAlignment.center,\n children: <Widget>[\n const Text(\n 'How Tall are you?',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white,\n fontSize: 28.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 10,\n ),\n const Text(\n 'To Personalize Your Fitness Goal ',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white60,\n fontSize: 20.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 20,\n ),\n Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: [\n Center(\n child: Container(\n height: size.height * 0.10,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(15),\n border: Border.all(\n color: Color.fromARGB(255, 145, 174, 225))),\n child: Center(\n child: text(\n textData: "Height",\n fontsize: 30.0,\n fontweight: FontWeight.bold,\n color: Color.fromARGB(255, 147, 148, 152)),\n ),\n ),\n ),\n SizedBox(\n height: 30,\n ),\n Center(\n child: Container(\n height: size.height * 0.13,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(20),\n border: Border.all(\n color: Color.fromARGB(255, 92, 89, 89)),\n // color: Colors.white,\n ),\n child: ListWheelScrollView.useDelegate(\n itemExtent: 100,\n // controller: fixedExtentScrollController,\n physics: FixedExtentScrollPhysics(),\n onSelectedItemChanged: (i) {\n print(numbers_Height[i]);\n },\n\n childDelegate: ListWheelChildLoopingListDelegate(\n children: <Widget>[\n\n ...numbers_Height.map((String number) {\n\n\n return Center(\n child: Text(\n number,\n style: const TextStyle(\n fontSize: 28.0,\n color: Colors.white,\n fontWeight: FontWeight.bold,\n fontStyle: FontStyle.normal,\n decoration: TextDecoration.none),\n ),\n );\n })\n ],\n ),\n ),\n ),\n )\n ],\n )\n ]),\n ),\n Container(\n // padding: EdgeInsets.symmetric(horizontal: 40),\n child: Column(\n mainAxisAlignment: MainAxisAlignment.start,\n crossAxisAlignment: CrossAxisAlignment.center,\n children: <Widget>[\n const Text(\n 'How much do you Weight?',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white,\n fontSize: 28.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 10,\n ),\n const Text(\n 'To Personalize Your Fitness Goal ',\n textAlign: TextAlign.center,\n style: TextStyle(\n color: Colors.white60,\n fontSize: 20.0,\n fontWeight: FontWeight.w600,\n ),\n ),\n const SizedBox(\n height: 20,\n ),\n Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: [\n Center(\n child: Container(\n height: size.height * 0.10,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(15),\n border: Border.all(\n color: Color.fromARGB(255, 145, 174, 225))),\n child: Center(\n child: text(\n textData: "Weight",\n fontsize: 30.0,\n fontweight: FontWeight.bold,\n color: Color.fromARGB(255, 147, 148, 152)),\n ),\n ),\n ),\n SizedBox(\n height: 30,\n ),\n Center(\n child: Container(\n height: size.height * 0.13,\n width: size.width * 0.5,\n decoration: BoxDecoration(\n borderRadius: BorderRadius.circular(20),\n border: Border.all(\n color: Color.fromARGB(255, 92, 89, 89)),\n ),\n child: ListWheelScrollView.useDelegate(\n itemExtent: 100,\n physics: FixedExtentScrollPhysics(),\n onSelectedItemChanged: (i) {\n print(numbers_Weight[i]);\n },\n childDelegate: ListWheelChildLoopingListDelegate(\n children: <Widget>[\n ...numbers_Weight.map((String number) {\n return Center(\n child: Text(\n number, //Here is the child value I would like to get\n style: const TextStyle(\n fontSize: 28.0,\n color: Colors.white,\n fontWeight: FontWeight.bold,\n fontStyle: FontStyle.normal,\n decoration: TextDecoration.none),\n ),\n );\n })\n ],\n ),\n ),\n ),\n )\n ],\n )\n ]),\n ),\n ],\n ),\n );\n}\nRun Code Online (Sandbox Code Playgroud)\n}
\n使用show和hide导入库的一部分。
// Import only foo.
import 'package:lib1/lib1.dart' show foo;
// Import all names EXCEPT foo.
import 'package:lib2/lib2.dart' hide foo;
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅使用库。
| 归档时间: |
|
| 查看次数: |
4219 次 |
| 最近记录: |