Untitled
unknown
plain_text
4 years ago
3.8 kB
4
Indexable
class CourseModel { CourseModel({ this.image, this.posImage, this.title, this.subtitle, }); String image; String posImage; String title; String subtitle; factory CourseModel.fromJson(Map<String, dynamic> json) => CourseModel( image: json["image"], posImage: json["posImage"], title: json["title"], subtitle: json["subtitle"], ); Map<String, dynamic> toJson() => { "image": image, "posImage": posImage, "title": title, "subtitle": subtitle, }; } List courseItem=[ { 'image':'assets/images/image111.png', 'posImage': "assets/images/coursepos1.png", 'title':'Character art', 'subtitle':'14h. 23min' }, { 'image':'assets/images/image211.png', 'posImage': "assets/images/coursepos2.png", 'title':'Character art', 'subtitle':'14h. 23min' } ]; List courseItem=[ { 'image':'assets/images/image111.png', 'posImage': "assets/images/coursepos1.png", 'title':'Character art', 'subtitle':'14h. 23min' }, { 'image':'assets/images/image211.png', 'posImage': "assets/images/coursepos2.png", 'title':'Character art', 'subtitle':'14h. 23min' } ]; List<CourseModel> course = (courseItem).map((x) => CourseModel.fromJson(x)).toList(); Row( children: List.generate(course.length, (index) { return Container( // width: KSize.getWidth(context, 211.29), margin: EdgeInsets.only( right: KSize.getWidth(context, 18.82)), padding: const EdgeInsets.only( left: 12, right: 22, top: 46, bottom: 20), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(22)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Stack( clipBehavior: Clip.none, children: [ Image.asset( course[index].image, height: KSize.getHeight(context, 141.35), width: KSize.getWidth(context, 116.86), ), Positioned( top: -35, right: -55, child: Image.asset(course[index].posImage), ) ], ), Text( course[index].title, style: KTextStyle.title4.copyWith( fontSize: 22.23, height: 24.7 / 22.23, color: Color(0xff1E2956), fontWeight: FontWeight.w500), ), Text(course[index].subtitle, style: KTextStyle.title4.copyWith( fontSize: 14, height: 1, color: Color(0xff767D95), fontWeight: FontWeight.w500)) ], ), ); }), ),
Editor is loading...