I am using data table with both vertical and horizontal scrollbar but vertical scrollbar indicator is showing but horizontal scrollbar indicator down not shows here is my code
class NewAppointments extends StatelessWidget {
const NewAppointments({super.key});
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
physics: const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columns: [
DataColumn(
label: Expanded(
child: Text(
‘Date’,
style: fontStyleSemibold,
),
),
),
DataColumn(
label: Expanded(
child: Text(
‘Patient Name’,
style: fontStyleSemibold,
),
),
),
DataColumn(
label: Expanded(
child: Text(
‘Contact’,
style: fontStyleSemibold,
),
),
),
DataColumn(
label: Expanded(
child: Text(
‘Doctor’,
style: fontStyleSemibold,
),
),
)
],
rows: [
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
maxLines: 1,
style: fontStyleRegular.copyWith(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
maxLines: 1,
style: fontStyleRegular.copyWith(fontSize: 14),
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
DataRow(
cells: [
DataCell(
Text(
’12-04-2023′,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Row(
children: [
CircularImage(
height: 24,
width: 24,
imageUrl: ‘assests/images/icon_person.png’,
onClick: () {}),
const SizedBox(
width: 4,
),
Text(
‘Muhammad Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
DataCell(
Text(
‘03028983053’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
DataCell(
Text(
‘Dr Hasnain’,
style: fontStyleRegular.copyWith(fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
],
),
),
);
}
}
3
Answers
Wrap your ScrollView with a ScrolBar and give the direction you want to show the scrolll bar.
You can use adaptive_scrollbar package. It will show multiple scrollbars
Try this demo :