我有电台列表在不同的工作表上 Flutter 我在我的主屏幕上调用了电台列表的功能,我想如果我点击电台列表,它将导航到我的编辑屏幕我已经使用了inkwell功能,但它仍然不工作我现在应该怎么做
import 'package:flutter/material.dart';
import 'package:flutter_application_1/Edit_Screen.dart';
class RadioListExample extends StatefulWidget {
@override
_RadioListExampleState createState() => _RadioListExampleState();
}
class _RadioListExampleState extends State<RadioListExample> {
int _selectedValue = 0;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const EditScreen()),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RadioListTile(
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Heading',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
Text(
'This is my subheading for test',
style: TextStyle(fontSize: 14),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
border: Border.all(width: 1.0),
),
padding: const EdgeInsets.all(6.0),
child: Text(
'Today 06:00 PM',
style: TextStyle(color: Colors.blue),
),
),
],
),
value: 1,
groupValue: _selectedValue,
onChanged: (value) {
setState(() {
_selectedValue = value as int;
});
},
secondary: Icon(
Icons.star,
color: Colors.blue,
),
),
],
),
);
}
}
字符串
我试过墨水瓶功能,但它不工作
2条答案
按热度按时间2nbm6dog1#
它的发生是因为RadioListTile小部件也可以点击,它通常调用它的点击的onChanged函数。你得想别的办法导航了。
5f0d552i2#
您需要在RadioListTile中将toggleable添加为true,并在onChange中添加事件。
字符串