Compare commits
2 Commits
dev
...
new-callpa
Author | SHA1 | Date | |
---|---|---|---|
|
97d6a3200b | ||
|
06251183df |
@ -20,6 +20,7 @@ class _CallPageState extends State<CallPage> {
|
||||
bool isKeypadVisible = false;
|
||||
bool icingProtocolOk = true;
|
||||
String _typedDigits = ""; // New state variable for pressed digits
|
||||
bool isOnHold = false; // New state variable for hold status
|
||||
|
||||
void _addDigit(String digit) {
|
||||
setState(() {
|
||||
@ -51,6 +52,12 @@ class _CallPageState extends State<CallPage> {
|
||||
});
|
||||
}
|
||||
|
||||
void _toggleHold() {
|
||||
setState(() {
|
||||
isOnHold = !isOnHold;
|
||||
});
|
||||
}
|
||||
|
||||
void _hangUp() {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
@ -61,6 +68,22 @@ class _CallPageState extends State<CallPage> {
|
||||
final double nameFontSize = isKeypadVisible ? 24.0 : 24.0; // Smaller font
|
||||
final double statusFontSize = isKeypadVisible ? 16.0 : 16.0; // Smaller status
|
||||
|
||||
// Calculate max visible chars based on screen width
|
||||
double screenWidth = MediaQuery.of(context).size.width;
|
||||
// Estimate ~14 pixels per character for the digit display (fontSize 24)
|
||||
// Subtract some padding (40) for the margins
|
||||
int estimatedMaxChars = ((screenWidth - 80) ~/ 14).clamp(10, 100) - 1;
|
||||
|
||||
// Helper function to format the displayed digits with dynamic width
|
||||
String _formatDisplayDigits() {
|
||||
if (_typedDigits.length <= estimatedMaxChars) {
|
||||
return _typedDigits;
|
||||
} else {
|
||||
// Show ellipsis at the beginning and the most recent digits
|
||||
return '...' + _typedDigits.substring(_typedDigits.length - estimatedMaxChars + 3);
|
||||
}
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
color: Colors.black,
|
||||
@ -121,11 +144,9 @@ class _CallPageState extends State<CallPage> {
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
if (isKeypadVisible) ...[
|
||||
// Add spacer to push keypad down
|
||||
const Spacer(flex: 2),
|
||||
|
||||
// Typed digits display
|
||||
if (isKeypadVisible) ...
|
||||
[
|
||||
// Updated typed digits display with dynamic width
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Row(
|
||||
@ -133,10 +154,10 @@ class _CallPageState extends State<CallPage> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
_typedDigits,
|
||||
_formatDisplayDigits(),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.right,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
color: Colors.white,
|
||||
@ -153,50 +174,67 @@ class _CallPageState extends State<CallPage> {
|
||||
),
|
||||
),
|
||||
|
||||
// Keypad grid
|
||||
// Modified keypad section
|
||||
Container(
|
||||
height: MediaQuery.of(context).size.height * 0.35,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 3,
|
||||
childAspectRatio: 1.3,
|
||||
mainAxisSpacing: 8,
|
||||
crossAxisSpacing: 8,
|
||||
children: List.generate(12, (index) {
|
||||
String label;
|
||||
if (index < 9) {
|
||||
label = '${index + 1}';
|
||||
} else if (index == 9) {
|
||||
label = '*';
|
||||
} else if (index == 10) {
|
||||
label = '0';
|
||||
} else {
|
||||
label = '#';
|
||||
}
|
||||
return GestureDetector(
|
||||
onTap: () => _addDigit(label),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(fontSize: 32, color: Colors.white),
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (var i = 0; i < 4; i++)
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
for (var j = 1; j <= 3; j++)
|
||||
Expanded(
|
||||
child: AspectRatio(
|
||||
aspectRatio: 1.5,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: () {
|
||||
String label;
|
||||
if (i < 3) {
|
||||
label = '${i * 3 + j}';
|
||||
} else {
|
||||
if (j == 1) label = '*';
|
||||
else if (j == 2) label = '0';
|
||||
else label = '#';
|
||||
}
|
||||
_addDigit(label);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.grey[900]?.withOpacity(0.5),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
i < 3 ? '${i * 3 + j}'
|
||||
: (j == 1 ? '*' : (j == 2 ? '0' : '#')),
|
||||
style: const TextStyle(
|
||||
fontSize: 32,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Add spacer after keypad
|
||||
const Spacer(flex: 1),
|
||||
] else ...[
|
||||
] else ...
|
||||
[
|
||||
const Spacer(),
|
||||
const Spacer(),
|
||||
// Control buttons
|
||||
Padding(
|
||||
@ -258,6 +296,7 @@ class _CallPageState extends State<CallPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
// New "mettre en attente" / Hold button
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
@ -279,6 +318,24 @@ class _CallPageState extends State<CallPage> {
|
||||
style: TextStyle(color: Colors.white, fontSize: 14)),
|
||||
],
|
||||
),
|
||||
// New "Hold" button inserted between Add Contact and Change SIM
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: _toggleHold,
|
||||
icon: Icon(
|
||||
isOnHold ? Icons.play_arrow : Icons.pause,
|
||||
color: Colors.white,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
isOnHold ? 'Resume' : 'Hold',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
// Change SIM
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
Loading…
Reference in New Issue
Block a user