KonectarEvents/lib/contacts_module/ui_screen/pno_showmore.dart

110 lines
3.7 KiB
Dart
Raw Permalink Normal View History

2024-10-08 12:01:59 +00:00
// import 'package:konectar_events/provider_class/phoneno_provider.dart';
// import 'package:konectar_events/ui_screen/bottom_sheet.dart';
import 'package:konectar_events/contacts_module/provider_class/phoneno_provider.dart';
import 'package:konectar_events/contacts_module/ui_screen/bottom_sheet.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PhoneShowMore extends StatefulWidget {
PhoneShowMore({required this.text, Key? key}) : super(key: key);
final int text;
@override
State<PhoneShowMore> createState() => _PhoneShowMoreState();
}
class _PhoneShowMoreState extends State<PhoneShowMore> {
List pno = [];
@override
void initState() {
// TODO: implement initState
super.initState();
affdata();
}
affdata() async {
final phone = Provider.of<PhonenoProvider>(context, listen: false);
await phone.phoneinfo(widget.text);
final phoneno = phone.phonenolist;
setState(() {
pno = phoneno;
});
print("Phone Numbers: ${pno}");
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Phone Numbers'),
),
body: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
constraints:
BoxConstraints(minWidth: MediaQuery.of(context).size.width),
color: Colors.white,
child: DataTable(
showCheckboxColumn: false,
columns: const [
DataColumn(
label: Expanded(
child: Text('phone Type',
style: TextStyle(fontWeight: FontWeight.w600),
softWrap: true),
)),
DataColumn(
label: Expanded(
child: Text('Phone No',
style:
TextStyle(fontWeight: FontWeight.w600)))),
],
rows: List.generate(
pno.length,
(index) => DataRow(
onSelectChanged: (value) {
print("message ${pno[index]}");
showModalBottomSheet(
useRootNavigator: true,
isScrollControlled: false,
enableDrag: true,
useSafeArea: true,
constraints: const BoxConstraints(
maxWidth: double.infinity,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(0),
),
),
clipBehavior: Clip.antiAliasWithSaveLayer,
context: context,
builder: (context) {
return bsheet(pno[index]);
},
);
},
cells: [
DataCell(Text(pno[index]['Phone type'].toString(),
softWrap: true)),
DataCell(Text(pno[index]['phone Number'].toString(),
softWrap: true)),
],
),
),
),
),
),
),
));
}
}