Commit 85a4efde0ef1e56a35080526f3c9b3453f906cd2
1 parent
c272c662
feat: 修改客服电话2个展示
Showing
1 changed file
with
125 additions
and
2 deletions
lib/pages/user/user_page.dart
| @@ -232,8 +232,7 @@ class _UserView extends StatelessWidget { | @@ -232,8 +232,7 @@ class _UserView extends StatelessWidget { | ||
| 232 | 12.verticalSpace, | 232 | 12.verticalSpace, |
| 233 | OutlinedButton( | 233 | OutlinedButton( |
| 234 | onPressed: () { | 234 | onPressed: () { |
| 235 | - String phone = 'tel:+8618827093087'; | ||
| 236 | - _launchPhone(phone); | 235 | + _showTeacherSelectionDialog(context); |
| 237 | }, | 236 | }, |
| 238 | style: normalButtonStyle, | 237 | style: normalButtonStyle, |
| 239 | child: Text( | 238 | child: Text( |
| @@ -309,6 +308,130 @@ class _UserView extends StatelessWidget { | @@ -309,6 +308,130 @@ class _UserView extends StatelessWidget { | ||
| 309 | }, | 308 | }, |
| 310 | ); | 309 | ); |
| 311 | 310 | ||
| 311 | + void _showTeacherSelectionDialog(BuildContext context) { | ||
| 312 | + showModalBottomSheet( | ||
| 313 | + context: context, | ||
| 314 | + backgroundColor: Colors.white, | ||
| 315 | + shape: const RoundedRectangleBorder( | ||
| 316 | + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), | ||
| 317 | + ), | ||
| 318 | + isScrollControlled: true, | ||
| 319 | + builder: (BuildContext context) { | ||
| 320 | + return SafeArea( | ||
| 321 | + child: Container( | ||
| 322 | + padding: const EdgeInsets.fromLTRB(16, 8, 16, 12), | ||
| 323 | + child: Column( | ||
| 324 | + mainAxisSize: MainAxisSize.min, | ||
| 325 | + children: [ | ||
| 326 | + // 拖拽指示器 | ||
| 327 | + Container( | ||
| 328 | + width: 40, | ||
| 329 | + height: 4, | ||
| 330 | + margin: const EdgeInsets.only(bottom: 6), | ||
| 331 | + decoration: BoxDecoration( | ||
| 332 | + color: Colors.grey[300], | ||
| 333 | + borderRadius: BorderRadius.circular(2), | ||
| 334 | + ), | ||
| 335 | + ), | ||
| 336 | + // 老师选项列表 | ||
| 337 | + Flexible( | ||
| 338 | + child: SingleChildScrollView( | ||
| 339 | + child: Column( | ||
| 340 | + mainAxisSize: MainAxisSize.min, | ||
| 341 | + children: [ | ||
| 342 | + // 恐龙老师选项 | ||
| 343 | + ListTile( | ||
| 344 | + contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), | ||
| 345 | + title: Text( | ||
| 346 | + '恐龙老师', | ||
| 347 | + style: TextStyle( | ||
| 348 | + fontSize: 14.sp, | ||
| 349 | + fontWeight: FontWeight.w600, | ||
| 350 | + color: Colors.black87, | ||
| 351 | + ), | ||
| 352 | + ), | ||
| 353 | + subtitle: Text( | ||
| 354 | + '19357119913', | ||
| 355 | + style: TextStyle( | ||
| 356 | + fontSize: 12.sp, | ||
| 357 | + color: Colors.grey[600], | ||
| 358 | + ), | ||
| 359 | + ), | ||
| 360 | + trailing: Icon( | ||
| 361 | + Icons.phone, | ||
| 362 | + color: Colors.green[600], | ||
| 363 | + size: 18, | ||
| 364 | + ), | ||
| 365 | + onTap: () { | ||
| 366 | + Navigator.pop(context); | ||
| 367 | + _launchPhone('tel:+8619357119913'); | ||
| 368 | + }, | ||
| 369 | + ), | ||
| 370 | + const Divider(height: 1), | ||
| 371 | + // Rose老师选项 | ||
| 372 | + ListTile( | ||
| 373 | + contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), | ||
| 374 | + title: Text( | ||
| 375 | + 'Rose老师', | ||
| 376 | + style: TextStyle( | ||
| 377 | + fontSize: 14.sp, | ||
| 378 | + fontWeight: FontWeight.w600, | ||
| 379 | + color: Colors.black87, | ||
| 380 | + ), | ||
| 381 | + ), | ||
| 382 | + subtitle: Text( | ||
| 383 | + '19033986279', | ||
| 384 | + style: TextStyle( | ||
| 385 | + fontSize: 12.sp, | ||
| 386 | + color: Colors.grey[600], | ||
| 387 | + ), | ||
| 388 | + ), | ||
| 389 | + trailing: Icon( | ||
| 390 | + Icons.phone, | ||
| 391 | + color: Colors.green[600], | ||
| 392 | + size: 18, | ||
| 393 | + ), | ||
| 394 | + onTap: () { | ||
| 395 | + Navigator.pop(context); | ||
| 396 | + _launchPhone('tel:+8619033986279'); | ||
| 397 | + }, | ||
| 398 | + ), | ||
| 399 | + ], | ||
| 400 | + ), | ||
| 401 | + ), | ||
| 402 | + ), | ||
| 403 | + const SizedBox(height: 6), | ||
| 404 | + // 取消按钮 | ||
| 405 | + SizedBox( | ||
| 406 | + width: double.infinity, | ||
| 407 | + child: OutlinedButton( | ||
| 408 | + onPressed: () { | ||
| 409 | + Navigator.pop(context); | ||
| 410 | + }, | ||
| 411 | + style: OutlinedButton.styleFrom( | ||
| 412 | + padding: const EdgeInsets.symmetric(vertical: 6), | ||
| 413 | + side: BorderSide(color: Colors.grey[300]!), | ||
| 414 | + shape: RoundedRectangleBorder( | ||
| 415 | + borderRadius: BorderRadius.circular(8), | ||
| 416 | + ), | ||
| 417 | + ), | ||
| 418 | + child: Text( | ||
| 419 | + '取消', | ||
| 420 | + style: TextStyle( | ||
| 421 | + fontSize: 14.sp, | ||
| 422 | + color: Colors.grey[600], | ||
| 423 | + ), | ||
| 424 | + ), | ||
| 425 | + ), | ||
| 426 | + ), | ||
| 427 | + ], | ||
| 428 | + ), | ||
| 429 | + ), | ||
| 430 | + ); | ||
| 431 | + }, | ||
| 432 | + ); | ||
| 433 | + } | ||
| 434 | + | ||
| 312 | void _launchPhone(String phone) async { | 435 | void _launchPhone(String phone) async { |
| 313 | if (await canLaunchUrl(Uri.parse(phone))) { | 436 | if (await canLaunchUrl(Uri.parse(phone))) { |
| 314 | await launchUrl(Uri.parse(phone)); | 437 | await launchUrl(Uri.parse(phone)); |