import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; class ListDetailScreen extends StatefulWidget { final String title; final String imagePath; final List paragraphs; const ListDetailScreen({ Key? key, required this.title, required this.imagePath, required this.paragraphs, }) : super(key: key); @override _ListDetailScreenState createState() => _ListDetailScreenState(); } class _ListDetailScreenState extends State { late List _readStatus; @override void initState() { super.initState(); _readStatus = List.generate(widget.paragraphs.length, (index) => false); } void _toggleReadStatus(int index) { setState(() { _readStatus[index] = !_readStatus[index]; }); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( title: Text(widget.title), backgroundColor: Color.fromARGB(225, 79, 76, 182), ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.only( bottomLeft: Radius.circular(40), bottomRight: Radius.circular(40), ), color: Color.fromARGB(225, 79, 76, 182), ), ), ), Padding( padding: const EdgeInsets.all(20.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset( widget.imagePath, width: 100, height: 100, fit: BoxFit.cover, ), const SizedBox(width: 16), Expanded( child: Text( widget.title, style: const TextStyle( fontSize: 22, fontWeight: FontWeight.bold, color: Colors.black, ), ), ), ], ), ), const SizedBox(height: 16), Expanded( child: Padding( padding: const EdgeInsets.all(18.0), child: ListView.builder( itemCount: widget.paragraphs.length, itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.only(bottom: 16.0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: // Text( // widget.paragraphs[index] + // style: TextStyle(color: Colors.black), Html( style: {"body": Style(color: Colors.black)}, data: widget.paragraphs.toString() + """ Enter a title, displayed at the top of the window.

Enter the main heading, usually the same as the title.

Be bold in stating your key points. Put them in a list:

  • The first item in your list
  • The second item; italicize key words

Improve your image by including an image.

A Great HTML Resource

Add a link to your favorite Web site. Break up your page with a horizontal rule or two.


Finally, link to another page in your own Web site.

© Wiley Publishing, 2011

""", ), ), // ), // Checkbox( // value: _readStatus[index], // onChanged: (bool? value) { // _toggleReadStatus(index); // }, // ), ], ), ); }, ), ), ), ], ), // ), ); } }