listview not working in flutter Android release mode I am using firebase as the database in my app.
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_admob/firebase_admob.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:mbmelearning/constants.dart';
class UsefulLinkMb extends StatefulWidget {
@override
_UsefulLinkMbState createState() => _UsefulLinkMbState();
}
class _UsefulLinkMbState extends State<UsefulLinkMb> {
BannerAd _bannerAd;
static const MobileAdTargetingInfo targetingInfo = MobileAdTargetingInfo();
BannerAd createBannerAd() {
return BannerAd(
adUnitId: BannerAd.testAdUnitId,
size: AdSize.smartBanner,
targetingInfo: targetingInfo,
listener: (MobileAdEvent event) {
print("BannerAd event $event");
},
);
}
@override
void initState() {
super.initState();
FirebaseAdMob.instance.initialize(appId: kBannerAdsId);
_bannerAd = createBannerAd()..load();
}
@override
Widget build(BuildContext context) {
Timer(
Duration(seconds: 1),
(){
_bannerAd.show();
}
);
return Scaffold(
backgroundColor: const Color(0xffffffff),
body: SafeArea(
child: ZStack([
HomeWebsites().pLTRB(10, 50, 10, 0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: (){
Navigator.pop(context);
},
child: VxBox(
child: Icon(
Icons.arrow_back_rounded,
color: kFirstColour,
),
).color(kSecondColour).size(50,40).make(),
),
VxBox(
child: "Useful Links".text.color(kFirstColour).bold.xl3.makeCentered(),
).color(kSecondColour).size(200,40).make(),
],
),
]),
),
);
}
}
class HomeWebsites extends StatefulWidget {
@override
_HomeWebsitesState createState() => _HomeWebsitesState();
}
class _HomeWebsitesState extends State<HomeWebsites> {
FirebaseFirestore firestore = FirebaseFirestore.instance;
@override
Widget build(BuildContext context) {
return Expanded(
child: StreamBuilder<QuerySnapshot>(
stream: firestore.collection('usefulwebsites').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) return const Text('Loading...');
final messageCount = snapshot.data.docs.length;
return ListView.builder(
itemCount: messageCount,
itemBuilder: (_, int index) {
final document = snapshot.data.docs[index];
final dynamic imglink = document.get('imgurl');
final dynamic title = document.get('urltitle');
final dynamic description = document.get('desc');
final dynamic weblink = document.get('weburl');
return SemText(
onPressed: (){
launch("${weblink.toString()}");
},
imgurl: "${imglink.toString()}",
title: "${title.toString()}",
desc: "${description.toString()}",
);
},
);
},
),
);
}
}
class SemText extends StatelessWidget {
final Function onPressed;
final String title;
final String imgurl;
final String desc;
SemText({this.onPressed, this.title, this.imgurl,this.desc});
@override
Widget build(BuildContext context) {
return TextButton(onPressed: onPressed, child: Container(
height: context.percentHeight*15,
width: context.percentWidth*80,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
border: Border.all(
color: kFirstColour,
),
),
child: HStack([
VStack([
Image.network(imgurl,
height: 40,
width: 40,
).centered(),
]).centered(),
10.widthBox,
VStack([
title.text.color(kFirstColour).bold.center.makeCentered(),
5.heightBox,
desc.text.color(kFirstColour).center.makeCentered(),
]).centered(),
]).scrollHorizontal(physics: AlwaysScrollableScrollPhysics()).p(20).centered(),
).cornerRadius(10));
}
}
flutter doctor
[√] Flutter (Channel stable, 2.0.5, on Microsoft Windows [Version 10.0.21359.1], locale en-IN) • Flutter version 2.0.5 at C:\Program Files\flutter • Framework revision adc687823a (3 weeks ago), 2021-04-16 09:40:20 -0700 • Engine revision b09f014e96 • Dart version 2.12.3
|Error 1 retrieving device properties for ro.product.cpu.abi: error: closed
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\lkrja\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174) • All Android licenses accepted.
[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.3) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.9.31129.286 • Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 4.1.0) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.56.0) • VS Code at C:\Users\lkrja\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.22.0
[√] Connected device (4 available) • ONEPLUS A3010 (mobile) • emulator-5554 • android-arm • Android null (API null) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.21359.1] • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 • Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.56 ! Device emulator-5554 is offline.
• No issues found!
User contributions licensed under CC BY-SA 3.0