Issue
I am New to Flutter And Dart.
Hope some one help me with this
I made a screen with this code below
// ignore_for_file: use_build_context_synchronously, library_private_types_in_public_api
import 'package:loading_animation_widget/loading_animation_widget.dart';
import '../flutter_flow/flutter_flow_theme.dart';
import 'package:flutter/material.dart';
import 'detailspage.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:quickalert/quickalert.dart';
class UdemyScreen1 extends StatefulWidget {
const UdemyScreen1({Key? key}) : super(key: key);
@override
_UdemyScreen1State createState() => _UdemyScreen1State();
}
class _UdemyScreen1State extends State<UdemyScreen1> {
MaterialColor materialColor = const MaterialColor(0xFF212967, {
50: Color(0xFFF4F5F8),
100: Color(0xFFE9EAF0),
200: Color(0xFFC8CAD9),
300: Color(0xFFA4A8C1),
400: Color(0xFF646A95),
500: Color(0xFF212967),
600: Color(0xFF1E255C),
700: Color(0xFF14193E),
800: Color(0xFF0F132F),
900: Color(0xFF0A0C1E),
});
bool _isloading = true;
List<Widget> childre = [];
@override
void initState() {
//Future.delayed(const Duration(seconds: 4), );
dotask();
super.initState();
}
void dotask() async {
const storage = FlutterSecureStorage();
String? token = await storage.read(key: 'token');
final response = await http
.get(Uri.parse('https://backend.s4tyendra.eu.org/udemy?token=$token'));
//QuickAlert.show(context: context, type: QuickAlertType.info);
if (response.statusCode != 200) {
QuickAlert.show(
context: context,
type: QuickAlertType.error,
title: 'Error',
text: 'Server Error Or Cannot connect');
} else {
final List<dynamic> list = jsonDecode(response.body)['data'];
for (var element in list) {
final id = element['course']['id'];
String title = element['course']['title'];
childre.add(Hero(
tag: id,
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(18, 18, 18, 18),
child: InkWell(
onTap: () async {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DeailspageWidget(
title: title,
id: id,
)),
);
},
child: ListTile(
title: Text(
title,
style: FlutterFlowTheme.of(context).title3,
),
subtitle: Text(
id,
style: FlutterFlowTheme.of(context).subtitle2,
),
trailing: Column(
children: [
FaIcon(
FontAwesomeIcons.circleRight,
color: materialColor.shade900,
size: 20,
),
],
),
tileColor: const Color.fromARGB(183, 255, 255, 255),
dense: true,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
),
),
),
));
}
setState(() {
_isloading = false;
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: materialColor.shade700,
body: SafeArea(
child: _isloading
? Center(
child: LoadingAnimationWidget.fourRotatingDots(
color: Colors.green, size: 60),
)
: GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: childre,
),
),
),
),
);
}
}
The token is unique user token Response from url is
{
"data": [
{
"course": {
"id": "4284484",
"title": "The Complete Dart Learning Guide [2022 Edition]"
}
},
{
"course": {
"id": "4447514",
"title": "Practical Next.js & React - Build a real WebApp with Next.js"
}
},
{
"course": {
"id": "4893248",
"title": "Object Detection on Custom Dataset With Keras Using Python"
}
},
{
"course": {
"id": "3014476",
"title": "The Ethical Hacking Bootcamp"
}
},
{
"course": {
"id": "4309598",
"title": "Master Data Analysis with Pandas"
}
},
{
"course": {
"id": "3014498",
"title": "Anonymity Guide For Ethical Hackers"
}
},
{
"course": {
"id": "3785848",
"title": "Learn Mobile Photography Techniques For Incredible Photos"
}
},
{
"course": {
"id": "3201902",
"title": "Kali Linux Basics Course For Cyber Security"
}
},
{
"course": {
"id": "4524086",
"title": "Learn Web Application Security For Beginners- OWASP Top 10"
}
},
{
"course": {
"id": "2051729",
"title": "SEO Training- Complete SEO Course & SEO Copywriting MASTERY"
}
},
{
"course": {
"id": "3658756",
"title": "Hands-On React. Build advanced React JS Frontend with expert"
}
},
{
"course": {
"id": "4390890",
"title": "Python for Deep Learning- Build Neural Networks in Python"
}
},
{
"course": {
"id": "4774346",
"title": "React.JS- The Complete Course for Beginners"
}
},
{
"course": {
"id": "4818998",
"title": "Three.js - The Complete Beginner to Advanced Course"
}
},
{
"course": {
"id": "2955276",
"title": "Deep Web- The complete Introduction to the hidden web"
}
},
{
"course": {
"id": "4782576",
"title": "Certified MongoDB Developer & Database Administrator Pack"
}
},
{
"course": {
"id": "1490124",
"title": "Complete Wordpress Website Developer Course"
}
},
{
"course": {
"id": "2503534",
"title": "Complete Machine Learning with R Studio - ML for 2022"
}
},
{
"course": {
"id": "4757506",
"title": "Cyber Security- Common Attacks"
}
},
{
"course": {
"id": "3726582",
"title": "Complete JAVASCRIPT with HTML5,CSS3 from zero to Expert-2022"
}
},
{
"course": {
"id": "4907934",
"title": "Modern GUI Development - Python (Software Development)"
}
},
{
"course": {
"id": "3432584",
"title": "Sentiment Analysis with NLP using Python and Flask"
}
},
{
"course": {
"id": "4704782",
"title": "LookML A-Z- Google Looker for Developers"
}
},
{
"course": {
"id": "2663858",
"title": "Google Analytics For Beginners"
}
},
{
"course": {
"id": "4260384",
"title": "Insight to Post Pandemic- Importance of Lean Six Sigma"
}
},
{
"course": {
"id": "4189430",
"title": "Digital Marketing Course for Fitness Professionals (2022)"
}
},
{
"course": {
"id": "4147070",
"title": "Become a Pro WordPress Freelancer & Get Web Design Clients"
}
},
{
"course": {
"id": "3202534",
"title": "Google BigQuery & PostgreSQL - Big Query for Data Analysis"
}
},
{
"course": {
"id": "4202336",
"title": "Object Oriented Programming in C++ & Interview Preparation"
}
},
{
"course": {
"id": "4897384",
"title": "Full Stack Web Developer"
}
},
{
"course": {
"id": "4678800",
"title": "Ethical Hacking- Linux Privilege Escalation"
}
},
{
"course": {
"id": "4719804",
"title": "Debugging Bootcamp - Software techniques beyond windbg,gdb"
}
},
{
"course": {
"id": "3407178",
"title": "Python And Flask Framework Complete Course"
}
},
{
"course": {
"id": "4898058",
"title": "2022-Basics of SQL using PostgreSQL"
}
},
{
"course": {
"id": "4663402",
"title": "CheckPoint Management Server R81 HA Configuration"
}
},
{
"course": {
"id": "1592856",
"title": "jQuery for Absolute Beginners - From Beginning to Advanced"
}
},
{
"course": {
"id": "4533524",
"title": "Batch Script Programming Crash Course (CMD)"
}
},
{
"course": {
"id": "3271350",
"title": "CheckPoint Firewall Administration R80"
}
},
{
"course": {
"id": "3776992",
"title": "CheckPoint-NGFW Security - Basic Introduction"
}
},
{
"course": {
"id": "4522782",
"title": "Blogging & Content Writing Course - Start A Profitable Blog"
}
},
{
"course": {
"id": "4870254",
"title": "Google Search Essential Class || GET CERTIFICATE ||"
}
},
{
"course": {
"id": "2411008",
"title": "HTML, CSS, & JavaScript - Certification Course for Beginners"
}
},
{
"course": {
"id": "2410960",
"title": "JavaScript & jQuery - Certification Course for Beginners"
}
},
{
"course": {
"id": "2410966",
"title": "HTML, JavaScript, & Bootstrap - Certification Course"
}
},
{
"course": {
"id": "2410976",
"title": "NGINX, Apache, SSL Encryption - Certification Course"
}
},
{
"course": {
"id": "2444060",
"title": "How the Internet Works & the Web Development Process"
}
},
{
"course": {
"id": "2444066",
"title": "Setup a Virtual Web Server using Linode or Digital Ocean"
}
},
{
"course": {
"id": "4290468",
"title": "PowerShell Functions Master Class"
}
},
{
"course": {
"id": "3684468",
"title": "Linux Command Line Terminal Basic for Beginners (In Hindi)"
}
},
{
"course": {
"id": "3225779",
"title": "Docker Course for Beginners"
}
},
{
"course": {
"id": "4423690",
"title": "Complete NFT Course (Beginner > 1000USD /Day Trading NFTs)"
}
},
{
"course": {
"id": "3105814",
"title": "Python-Introduction to Data Science and Machine learning A-Z"
}
},
{
"course": {
"id": "4845712",
"title": "Java Crash Course for Beginners 2022"
}
},
{
"course": {
"id": "4359810",
"title": "CSS, JavaScript,PHP And Python Programming All in One Course"
}
},
{
"course": {
"id": "4233882",
"title": "PSPO1 Practice Tests Scrum Product Owner certification-160Q"
}
},
{
"course": {
"id": "4031642",
"title": "PMI-ACP\u00ae- Agile Certified Project Management 200 Questions"
}
},
{
"course": {
"id": "3495852",
"title": "Python For Beginners Course In-Depth"
}
},
{
"course": {
"id": "3062570",
"title": "Building Android Widgets from scratch (Learn 8 Widgets)"
}
},
{
"course": {
"id": "4363642",
"title": "Cybersecurity- Security Operations Center (SOC) Analyst NOW!"
}
},
{
"course": {
"id": "2205700",
"title": "IP Addressing and Subnetting - Zero to Hero"
}
},
{
"course": {
"id": "4121154",
"title": "The Advanced SQL Course"
}
},
{
"course": {
"id": "2879462",
"title": "Public Speaking- A tactical approach"
}
},
{
"course": {
"id": "3717522",
"title": "Instagram Marketing 2021- Growth and Promotion on Instagram"
}
},
{
"course": {
"id": "3612808",
"title": "Master all the MS Excel Macros and the basics of Excel VBA"
}
},
{
"course": {
"id": "4763230",
"title": "Learn Python. Your First Computer Programming Class."
}
},
{
"course": {
"id": "3062508",
"title": "Beginners guide to Android App Development (Step by Step)"
}
},
{
"course": {
"id": "3518544",
"title": "Learn Machine learning & AI (Including Hands-on 3 Projects)"
}
},
{
"course": {
"id": "2411016",
"title": "JavaScript, Bootstrap, & PHP - Certification for Beginners"
}
},
{
"course": {
"id": "3542398",
"title": "Build A Search Engine With Python- Computer Science & Python"
}
},
{
"course": {
"id": "4286302",
"title": "Python For Ethical Hacking"
}
},
{
"course": {
"id": "473160",
"title": "Web Design for Web Developers- Build Beautiful Websites!"
}
},
{
"course": {
"id": "65330",
"title": "Web Development By Doing- HTML / CSS From Scratch"
}
},
{
"course": {
"id": "173548",
"title": "Build Your First Website in 1 Week with HTML5 and CSS3"
}
},
{
"course": {
"id": "3156854",
"title": "Cyber Security- The Ultimate Beginner's Handbook"
}
},
{
"course": {
"id": "2760796",
"title": "Data Science, Machine Learning, Data Analysis, Python & R"
}
},
{
"course": {
"id": "1639602",
"title": "WordPress Web Design & Email Marketing"
}
},
{
"course": {
"id": "4861820",
"title": "Zero to Hero in Jest Unit and Integration Testing with React"
}
},
{
"course": {
"id": "4551820",
"title": "JavaScript And PHP Programming Complete Course"
}
},
{
"course": {
"id": "3972018",
"title": "HTML 5,Python,Flask Framework All In One Complete Course"
}
},
{
"course": {
"id": "3047216",
"title": "Python for beginners - Learn all the basics of python"
}
},
{
"course": {
"id": "2617302",
"title": "Apache Spark with Scala useful for Databricks Certification"
}
},
{
"course": {
"id": "2861796",
"title": "Python And Django Framework For Beginners Complete Course"
}
},
{
"course": {
"id": "4425548",
"title": "Learn MONGODB in 10 videos"
}
},
{
"course": {
"id": "3014496",
"title": "Python Hacking Course For Ethical Hackers"
}
}
],
"status": true
}
I Tried A Lot but i Cannot
example: This
I want to add Search bar like this and search in the list of widgets and display Someone give me an idea to do it, I dont know if it can be added or not Thanks in advance.
I added required details. Maybe pubspec.yaml is not needed
Solution
ok you can use mapping though final{} and return data
Answered By - Tor Lech
Answer Checked By - Robin (JavaFixing Admin)