我用flutter做了一个应用程序,在这个特定的屏幕上,我列出了在我的银行注册的动物,我做的一些事情不起作用,我想是图像。能帮我吗?
错误:
Image provider: AssetImage(bundle: null, name: "assets/images/ryan-parker-ucnZANGmyxM-unsplash.jpg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#5d3fc(), name:
"assets/images/ryan-parker-ucnZANGmyxM-unsplash.jpg", scale: 1)
DioException [bad response]: The request returned an invalid status code of 400.
DioException [bad response]: The request returned an invalid status code of 400.
Another exception was thrown: Vertical viewport was given unbounded width.
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1965:12
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/mouse_tracker.dart:205:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/mouse_tracker.dart:205:12
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
Another exception was thrown: Cannot hit test a render box that has never been laid out.
import '../models/animal_model.dart';
import '/flutter_flow/flutter_flow_icon_button.dart';
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/flutter_flow/flutter_flow_widgets.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
import 'catalog_controller.dart';
import 'catalog_model.dart';
export 'catalog_model.dart';
class CatalogWidget extends StatefulWidget {
const CatalogWidget({Key? key}) : super(key: key);
@override
_CatalogWidgetState createState() => _CatalogWidgetState();
}
class _CatalogWidgetState extends State<CatalogWidget> {
late CatalogModel _model;
List<AnimalModel> lista = List.empty(growable: true);
final animaisController = CatalogController();
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
void initState() {
super.initState();
_model = createModel(context, () => CatalogModel());
listar();
}
Future<void> listar() async {
lista = await animaisController.listarAnimais();
setState(() {});
print(lista);
}
@override
void dispose() {
_model.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
var tam = MediaQuery.of(context).size;
return GestureDetector(
onTap: () => _model.unfocusNode.canRequestFocus
? FocusScope.of(context).requestFocus(_model.unfocusNode)
: FocusScope.of(context).unfocus(),
child: Scaffold(
key: scaffoldKey,
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Color(0xFF6A02F5),
automaticallyImplyLeading: false,
actions: [
FlutterFlowIconButton(
borderColor: Color(0x0022282F),
borderRadius: 20,
borderWidth: 1,
buttonSize: 70,
fillColor: Color(0x00616161),
icon: Icon(
Icons.person,
color: Color(0xFFFCBF08),
size: 35,
),
onPressed: () async {
context.pushNamed('profile');
},
),
],
centerTitle: false,
elevation: 0,
),
body: SafeArea(
top: true,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Image.asset(
'assets/images/Captura_de_tela_2023-06-02_022508.jpg',
width: 419,
height: 127,
fit: BoxFit.cover,
),
),
Column(
mainAxisSize: MainAxisSize.max,
children: [
Text(
'Conheça nossos animais',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Outfit',
color: Color(0xFF1C1C1C),
fontSize: 20,
fontWeight: FontWeight.w600,
),
),
Text(
'clique em \"conhecer\" para ver ser direcionado ao whatsapp da ONG',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Outfit',
color: Color(0xFF1C1C1C),
fontSize: 12,
),
),
],
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(10, 10, 10, 10),
child: ListView.builder(
shrinkWrap: true,
itemCount: lista.length,
scrollDirection: Axis.vertical,
itemBuilder: (BuildContext context, int index) {
return Container(
width: tam.width * 0.4,
height: tam.height * .1,
decoration: BoxDecoration(
color: Color(0xFC6D04FA),
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Align(
alignment:
AlignmentDirectional(-1.00, 0.00),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(
20, 0, 0, 0),
child: Container(
width: 120,
height: 120,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
shape: BoxShape.circle,
),
child: Image.memory(
lista
.elementAt(index)
.getFoto_animal,
width: 10.0,
height: 10.0,
fit: BoxFit.cover,
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 10, 0, 0),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Text(
lista
.elementAt(index)
.getNome
.toString(),
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color: Color(0xFFFEBF03),
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
Text(
lista
.elementAt(index)
.getSexo
.toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color:
Color(0xFFF3F4F5),
),
),
Text(
lista
.elementAt(index)
.getIdade
.toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color:
Color(0xFFF3F4F5),
),
),
Text(
lista
.elementAt(index)
.getPorte
.toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color:
Color(0xFFF3F4F5),
),
),
Text(
lista
.elementAt(index)
.getDescricao
.toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color:
Color(0xFFF3F4F5),
),
),
Text(
lista
.elementAt(index)
.getCastrado
.toString(),
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Outfit',
color:
Color(0xFFF3F4F5),
),
),
Padding(
padding: EdgeInsetsDirectional
.fromSTEB(0, 5, 0, 0),
child: FFButtonWidget(
onPressed: () {
print('Button pressed ...');
},
text: 'Conhecer',
options: FFButtonOptions(
height: 14,
padding: EdgeInsetsDirectional
.fromSTEB(24, 0, 24, 0),
iconPadding:
EdgeInsetsDirectional
.fromSTEB(0, 0, 0, 0),
color: Color(0xFF31EF41),
textStyle: FlutterFlowTheme
.of(context)
.titleSmall
.override(
fontFamily: 'Outfit',
color: Colors.white,
),
elevation: 3,
borderSide: BorderSide(
color: Colors.transparent,
width: 1,
),
borderRadius:
BorderRadius.circular(8),
),
),
),
],
),
),
],
),
);
})),
],
),
),
],
),
),
),
),
);
}
}
我试图列出动物及其字段,但当我执行时,屏幕是空白的,只有导航栏出现
1条答案
按热度按时间kkbh8khc1#
第一步:
在pupspec.yaml上添加以下行
第二步:
第三步: