Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.5 kB
2
Indexable
Never
import 'package:flutter/material.dart';
import 'package:news_app/article.dart';

class ArticleDetailPage extends StatelessWidget {
  static const routeName = '/article_detail';
  final Article article;
  const ArticleDetailPage({super.key, required this.article});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(article.title),),
      body: SingleChildScrollView(child: Column(
        children: [
          Image.network(article.urlToImage),
          Padding(
            padding: const EdgeInsets.all(10.0),
            child: Column( 
              children: [
                Text(article.description),
            const Divider(color: Colors.grey,),
            Text(
              article.title,
              style: const TextStyle(
                color: Colors.black,
                fontWeight: FontWeight.bold,
                fontSize: 24,
              ),
            ),
            const Divider(color: Colors.grey),
            Text('Date    : ${article.publishedAt}'),
            Text('Author  : ${article.author}'),
            const Divider(color: Colors.grey),
            Text(
              article.content,
              style: const TextStyle(fontSize: 16),
            ),
            const SizedBox(height: 10),
            ElevatedButton(onPressed: (){}, child: const Text('Read More'))
              ],
            ),
          )
        ],
      )),
    );
  }
}