mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2026-09-01 12:40:43 +00:00
- Bump all apps to sdk >=3.0.0 <4.0.0 and add flutter_lints + a shared analysis_options.yaml to every app (flutter analyze is now green repo-wide) - Fix real compile errors in firebase_google_authentication and image_editor, plus deprecated APIs (Matrix4, SvgPicture.color, textScaleFactor), missing async 'mounted' guards, and misc lints via dart fix + manual fixes - Align pubspec 'name' with each folder and Android namespace/applicationId with the documented github.nisrulz.* convention - Convert bmi_calculator from a legacy Flutter module to a standard app with a proper android/ scaffold; fix missing android:exported in launcher manifests across 22 apps so all Android builds pass - Untrack generated build files (GeneratedPluginRegistrant, .flutter-plugins-dependencies) and ignore them
94 lines
3.7 KiB
Dart
94 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:news_memes_app/services/getNews.dart';
|
|
|
|
class NewsScreen extends StatefulWidget {
|
|
final List<NewsModel> news;
|
|
|
|
const NewsScreen(this.news, {super.key});
|
|
|
|
@override
|
|
State<NewsScreen> createState() => _NewsScreenState();
|
|
}
|
|
|
|
class _NewsScreenState extends State<NewsScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final Size size = MediaQuery.of(context).size;
|
|
return Scaffold(
|
|
backgroundColor: Color(0xFF28496E),
|
|
body: Center(
|
|
child: Center(
|
|
child: InteractiveViewer(
|
|
child: ListView(
|
|
// magnification: 1.2,
|
|
children: widget.news
|
|
.map((e) => Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 15, horizontal: 20),
|
|
child: Container(
|
|
width: size.width * 0.88,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(25),
|
|
color: Colors.white,
|
|
),
|
|
child: Column(
|
|
children: [
|
|
e.imageUrl == 'NoImage'
|
|
? Container(
|
|
height: 40,
|
|
color: Colors.grey,
|
|
child: Text(
|
|
'No Preview Available!',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w300,
|
|
color: Colors.black38,
|
|
),
|
|
),
|
|
)
|
|
: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 10, horizontal: 10),
|
|
child: ClipRRect(
|
|
borderRadius:
|
|
BorderRadius.circular(30),
|
|
child: Image(
|
|
image: NetworkImage(e.imageUrl))),
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
|
child: Text(
|
|
e.title,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black54,
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.fromLTRB(10, 0, 10, 20),
|
|
child: Text(
|
|
e.description,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w300,
|
|
color: Colors.black54,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
))
|
|
.toList(),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|