listbox test
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NewsItem extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final Image image;
|
||||||
|
|
||||||
|
NewsItem({
|
||||||
|
required this.title,
|
||||||
|
required this.description,
|
||||||
|
required this.image,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
leading: image,
|
||||||
|
title: Text(title),
|
||||||
|
subtitle: Text(description),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class NewsList extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListView(
|
||||||
|
children: [
|
||||||
|
NewsItem(
|
||||||
|
title: 'News Title 1',
|
||||||
|
description: 'This is the description for news item 1.',
|
||||||
|
image: Image.file('C:\\Users\\kevin\\StudioProjects\\demoapp_1\\android\\app\\src\\main\\play_store_512.png')
|
||||||
|
//network('https://example.com/image1.jpg'),
|
||||||
|
),
|
||||||
|
NewsItem(
|
||||||
|
title: 'News Title 2',
|
||||||
|
description: 'This is the description for news item 2.',
|
||||||
|
image: Image.network('https://example.com/image2.jpg'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-3
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'NewsItem.dart';
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
const MyHomePage({super.key, required this.title});
|
const MyHomePage({super.key, required this.title});
|
||||||
|
|
||||||
@@ -151,11 +153,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
static const TextStyle optionStyle =
|
static const TextStyle optionStyle =
|
||||||
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
|
||||||
static const List<Widget> _widgetOptions = <Widget>[
|
static /*const*/ List<Widget> _widgetOptions = <Widget>[
|
||||||
Text(
|
/*Text(
|
||||||
'Index 0: News',
|
'Index 0: News',
|
||||||
style: optionStyle,
|
style: optionStyle,
|
||||||
),
|
),*/
|
||||||
|
NewsList(),
|
||||||
Text(
|
Text(
|
||||||
'Index 1: Mängel',
|
'Index 1: Mängel',
|
||||||
style: optionStyle,
|
style: optionStyle,
|
||||||
|
|||||||
Reference in New Issue
Block a user