Reputation: 1
Expanded(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
),
),
child: ListView(
children: [
const ListTile(
title: Text('This is a task.'),
trailing: Checkbox(
value: false, onChanged: (value) => onChanged()),
),
],
),
),
),
//I tried to delete onChanged but it doesn't work says OnCgange required. I am open any suggestion
Upvotes: 0
Views: 229
Reputation: 316
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SafeArea(
child: Scaffold(
body: Center(
child: Expanded(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20.0),
topRight: Radius.circular(20.0),
),
),
child: ListView(
children: [
ListTile(
title: Text('This is a task.'),
trailing: Checkbox(
value: false,
onChanged: (value) => null,
),
)
],
),
),
),
),
),
),
);
}
}
remove the cont value in front of the Listtile and modify unchanged function
Upvotes: 1