diff --git a/lib/pages/user/user_page.dart b/lib/pages/user/user_page.dart index c793c64..cd0ff09 100644 --- a/lib/pages/user/user_page.dart +++ b/lib/pages/user/user_page.dart @@ -232,8 +232,7 @@ class _UserView extends StatelessWidget { 12.verticalSpace, OutlinedButton( onPressed: () { - String phone = 'tel:+8618827093087'; - _launchPhone(phone); + _showTeacherSelectionDialog(context); }, style: normalButtonStyle, child: Text( @@ -309,6 +308,130 @@ class _UserView extends StatelessWidget { }, ); + void _showTeacherSelectionDialog(BuildContext context) { + showModalBottomSheet( + context: context, + backgroundColor: Colors.white, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + isScrollControlled: true, + builder: (BuildContext context) { + return SafeArea( + child: Container( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 12), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // 拖拽指示器 + Container( + width: 40, + height: 4, + margin: const EdgeInsets.only(bottom: 6), + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(2), + ), + ), + // 老师选项列表 + Flexible( + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // 恐龙老师选项 + ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + title: Text( + '恐龙老师', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + ), + ), + subtitle: Text( + '19357119913', + style: TextStyle( + fontSize: 12.sp, + color: Colors.grey[600], + ), + ), + trailing: Icon( + Icons.phone, + color: Colors.green[600], + size: 18, + ), + onTap: () { + Navigator.pop(context); + _launchPhone('tel:+8619357119913'); + }, + ), + const Divider(height: 1), + // Rose老师选项 + ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + title: Text( + 'Rose老师', + style: TextStyle( + fontSize: 14.sp, + fontWeight: FontWeight.w600, + color: Colors.black87, + ), + ), + subtitle: Text( + '19033986279', + style: TextStyle( + fontSize: 12.sp, + color: Colors.grey[600], + ), + ), + trailing: Icon( + Icons.phone, + color: Colors.green[600], + size: 18, + ), + onTap: () { + Navigator.pop(context); + _launchPhone('tel:+8619033986279'); + }, + ), + ], + ), + ), + ), + const SizedBox(height: 6), + // 取消按钮 + SizedBox( + width: double.infinity, + child: OutlinedButton( + onPressed: () { + Navigator.pop(context); + }, + style: OutlinedButton.styleFrom( + padding: const EdgeInsets.symmetric(vertical: 6), + side: BorderSide(color: Colors.grey[300]!), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + child: Text( + '取消', + style: TextStyle( + fontSize: 14.sp, + color: Colors.grey[600], + ), + ), + ), + ), + ], + ), + ), + ); + }, + ); + } + void _launchPhone(String phone) async { if (await canLaunchUrl(Uri.parse(phone))) { await launchUrl(Uri.parse(phone));