@@ -1167,5 +1167,22 @@ | |||
"translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", | |||
"choose_language": "请选择您的语言和要翻译的语言", | |||
"translation_butler_rules": "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -1167,5 +1167,22 @@ | |||
"translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", | |||
"choose_language": "请选择您的语言和要翻译的语言", | |||
"translation_butler_rules": "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -1166,5 +1166,22 @@ | |||
"translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", | |||
"choose_language": "请选择您的语言和要翻译的语言", | |||
"translation_butler_rules": "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -1167,5 +1167,22 @@ | |||
"translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", | |||
"choose_language": "请选择您的语言和要翻译的语言", | |||
"translation_butler_rules": "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -1167,9 +1167,23 @@ | |||
"translation_butler_tips": "您的实时贴身翻译,随时随地帮您解决语言不通", | |||
"choose_language": "请选择您的语言和要翻译的语言", | |||
"translation_butler_rules": "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -1167,5 +1167,22 @@ | |||
"translation_butler_tips": "您的實時貼身翻譯,隨時隨地幫您解決語言不通", | |||
"choose_language": "請選擇您的語言和要翻譯的語言", | |||
"translation_butler_rules": "呼叫管家需要預扣50H幣,超過10分鐘後根據每分鐘5H幣進行自動扣費,餘額不足時自動結束", | |||
"translation_butler_call": "呼叫管家" | |||
"translation_butler_call": "呼叫管家", | |||
"travel_my_location": "我的位置", | |||
"travel_go_where": "你要去哪儿", | |||
"travel_tips": "当前定位非实时监测,每次需点击“距离查询”按钮查询", | |||
"travel_check_distance": "距离查询", | |||
"travel_check_distance_result": "根据定位查询,您的当前距离目标地点相距:", | |||
"translation_butler_tips2": "当前排队人数过多,感谢您的耐心等待", | |||
"translation_butler_tips3": "正在为您呼叫管家", | |||
"translation_butler_wait_people": "等待人数", | |||
"translation_butler_wait_people_unit": "位", | |||
"translation_butler_wait_time": "预计还需等待", | |||
"translation_butler_already_wait": "已等待", | |||
"translation_butler_cancel": "取消呼叫", | |||
"translation_butler_wait_service": "等待服务", | |||
"translation_butler_dialog_title": "实时帮-翻译管家", | |||
"translation_butler_dialog_order": "s1通过系统下单", | |||
"translation_butler_dialog_start_service": "开始服务", | |||
"translation_butler_dialog_start_chat": "开始聊天" | |||
} |
@@ -275,6 +275,8 @@ class Constants { | |||
static const Splash_OPENED = 'splashOpened_13'; //是否加载过引导页 | |||
static const LocalUsrInfo = 'LocalUsrInfo'; //本地用户数据 | |||
static const TranslationHelper = 'translationhelper'; //加载翻译管家相关信息 | |||
//定位获取太慢,缓存经纬度 | |||
static const Latitude = 'Latitude'; | |||
static const Longitude = 'Longitude'; | |||
@@ -2371,6 +2371,40 @@ class I18n implements WidgetsLocalizations { | |||
String get translation_butler_rules => "呼叫管家需要预扣50H币,超过10分钟后根据每分钟5H币进行自动扣费,余额不足时自动结束"; | |||
/// "呼叫管家" | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
} | |||
class _I18n_en_US extends I18n { | |||
@@ -5890,6 +5924,57 @@ class _I18n_vi_VN extends I18n { | |||
/// "呼叫管家" | |||
@override | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
@override | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
@override | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
@override | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
@override | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
@override | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
@override | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
@override | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
@override | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
@override | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
@override | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
@override | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
@override | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
@override | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
@override | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
@override | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
@override | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
@override | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
@override | |||
TextDirection get textDirection => TextDirection.ltr; | |||
@@ -9405,6 +9490,57 @@ class _I18n_zh_HK extends I18n { | |||
/// "呼叫管家" | |||
@override | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
@override | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
@override | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
@override | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
@override | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
@override | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
@override | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
@override | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
@override | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
@override | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
@override | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
@override | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
@override | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
@override | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
@override | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
@override | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
@override | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
@override | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
@override | |||
TextDirection get textDirection => TextDirection.ltr; | |||
@@ -12920,6 +13056,57 @@ class _I18n_zh_CN extends _I18n_zh_HK { | |||
/// "呼叫管家" | |||
@override | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
@override | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
@override | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
@override | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
@override | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
@override | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
@override | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
@override | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
@override | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
@override | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
@override | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
@override | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
@override | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
@override | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
@override | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
@override | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
@override | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
@override | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
@override | |||
TextDirection get textDirection => TextDirection.ltr; | |||
@@ -16432,6 +16619,57 @@ class _I18n_ko_KR extends I18n { | |||
/// "呼叫管家" | |||
@override | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
@override | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
@override | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
@override | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
@override | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
@override | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
@override | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
@override | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
@override | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
@override | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
@override | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
@override | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
@override | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
@override | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
@override | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
@override | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
@override | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
@override | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
@override | |||
TextDirection get textDirection => TextDirection.ltr; | |||
@@ -19947,6 +20185,57 @@ class _I18n_ja_JP extends I18n { | |||
/// "呼叫管家" | |||
@override | |||
String get translation_butler_call => "呼叫管家"; | |||
/// "我的位置" | |||
@override | |||
String get travel_my_location => "我的位置"; | |||
/// "你要去哪儿" | |||
@override | |||
String get travel_go_where => "你要去哪儿"; | |||
/// "当前定位非实时监测,每次需点击“距离查询”按钮查询" | |||
@override | |||
String get travel_tips => "当前定位非实时监测,每次需点击“距离查询”按钮查询"; | |||
/// "距离查询" | |||
@override | |||
String get travel_check_distance => "距离查询"; | |||
/// "根据定位查询,您的当前距离目标地点相距:" | |||
@override | |||
String get travel_check_distance_result => "根据定位查询,您的当前距离目标地点相距:"; | |||
/// "当前排队人数过多,感谢您的耐心等待" | |||
@override | |||
String get translation_butler_tips2 => "当前排队人数过多,感谢您的耐心等待"; | |||
/// "正在为您呼叫管家" | |||
@override | |||
String get translation_butler_tips3 => "正在为您呼叫管家"; | |||
/// "等待人数" | |||
@override | |||
String get translation_butler_wait_people => "等待人数"; | |||
/// "位" | |||
@override | |||
String get translation_butler_wait_people_unit => "位"; | |||
/// "预计还需等待" | |||
@override | |||
String get translation_butler_wait_time => "预计还需等待"; | |||
/// "已等待" | |||
@override | |||
String get translation_butler_already_wait => "已等待"; | |||
/// "取消呼叫" | |||
@override | |||
String get translation_butler_cancel => "取消呼叫"; | |||
/// "等待服务" | |||
@override | |||
String get translation_butler_wait_service => "等待服务"; | |||
/// "实时帮-翻译管家" | |||
@override | |||
String get translation_butler_dialog_title => "实时帮-翻译管家"; | |||
/// "s1通过系统下单" | |||
@override | |||
String get translation_butler_dialog_order => "s1通过系统下单"; | |||
/// "开始服务" | |||
@override | |||
String get translation_butler_dialog_start_service => "开始服务"; | |||
/// "开始聊天" | |||
@override | |||
String get translation_butler_dialog_start_chat => "开始聊天"; | |||
@override | |||
TextDirection get textDirection => TextDirection.ltr; | |||
@@ -1,3 +1,5 @@ | |||
import 'dart:async'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:chat/data/UserData.dart'; | |||
import 'package:chat/data/chat_data_mgr.dart'; | |||
@@ -12,6 +14,7 @@ import 'package:chat/utils/MessageMgr.dart'; | |||
import 'package:chat/utils/group_member_model.dart'; | |||
import 'package:chat/utils/msgHandler.dart'; | |||
import 'package:chat/utils/screen.dart'; | |||
import 'package:chat/utils/sp_utils.dart'; | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:oktoast/oktoast.dart'; | |||
@@ -45,8 +48,46 @@ class TranslationButlerPageState extends State<TranslationButlerPage> { | |||
@override | |||
void initState() { | |||
super.initState(); | |||
initData(); | |||
WidgetsBinding.instance.addPostFrameCallback((_) { | |||
Future.delayed(Duration(seconds: 4),(){ | |||
CustomUI.buildTranslationHelperOrderDialog(context); | |||
}); | |||
}); | |||
} | |||
initData() async{ | |||
String time= (await SPUtils.get(Constants.TranslationHelper)); | |||
if(time!=null){ | |||
print('time:$time'); | |||
int second = int.parse(time)~/1000; | |||
// if(DateTime.now().millisecondsSinceEpoch~/1000-second>5*3600){ ///超过5小时清除缓存记录 | |||
// SPUtils.save(Constants.TranslationHelper,null); | |||
// return; | |||
// } | |||
secondsPassed = ((DateTime.now().millisecondsSinceEpoch~/1000-second)); | |||
apply(); | |||
}else{ | |||
print('time: null'); | |||
} | |||
} | |||
apply(){ | |||
isApply = false; | |||
timer = Timer.periodic(Duration(seconds: 1), (Timer t){ | |||
handleTick(); | |||
}); | |||
setState(() {}); | |||
} | |||
@override | |||
void didChangeDependencies() { | |||
super.didChangeDependencies(); | |||
@@ -59,11 +100,21 @@ class TranslationButlerPageState extends State<TranslationButlerPage> { | |||
I18n.of(context).Korean, | |||
I18n.of(context).Japanese, | |||
]; | |||
} | |||
@override | |||
void dispose() { | |||
// MessageMgr().off('Update Group Info', updateGroupInfo); | |||
timer?.cancel(); | |||
if(!isApply && timeStamp!=null){ | |||
print('保存时间戳$timeStamp'); | |||
SPUtils.save(Constants.TranslationHelper,timeStamp.toString()); | |||
} | |||
super.dispose(); | |||
} | |||
@@ -72,16 +123,22 @@ class TranslationButlerPageState extends State<TranslationButlerPage> { | |||
return myPop.PopupMenuButton( | |||
child: Container( | |||
constraints: BoxConstraints( | |||
minHeight: 41, | |||
minWidth: 115, | |||
maxWidth: 165), | |||
decoration: BoxDecoration(color: Color(0xffD3E7FF),borderRadius:BorderRadius.circular(10) ), | |||
constraints: | |||
BoxConstraints(minHeight: 41, minWidth: 115, maxWidth: 165), | |||
decoration: BoxDecoration( | |||
color: Color(0xffD3E7FF), | |||
borderRadius: BorderRadius.circular(10)), | |||
child: Row( | |||
children: <Widget>[ | |||
Expanded(child: Text(langList[curIndex],textAlign: TextAlign.center,textScaleFactor: 1.0,style: TextStyle(color: Colors.black, fontSize: 16),)), | |||
Expanded( | |||
child: Text( | |||
langList[curIndex], | |||
textAlign: TextAlign.center, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xff4A5E76), fontSize: 14), | |||
)), | |||
Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily), | |||
color: Colors.grey) | |||
size: 30, color: Color(0xff4A5E76)) | |||
], | |||
), | |||
), | |||
@@ -131,9 +188,17 @@ class TranslationButlerPageState extends State<TranslationButlerPage> { | |||
), | |||
// leading: CustomUI.buildCustomLeading(context), | |||
centerTitle: true, | |||
actions: <Widget>[ Container(child: CustomUI.buildImageLabel( | |||
R.assetsImagesCoin, Provider.of<MoneyChangeProvider>(context).money, | |||
isLeft: true),decoration: BoxDecoration(borderRadius:BorderRadius.circular(10)),),SizedBox(width: 10,)], | |||
actions: <Widget>[ | |||
Container( | |||
child: CustomUI.buildImageLabel(R.assetsImagesCoin, | |||
Provider.of<MoneyChangeProvider>(context).money, | |||
isLeft: true), | |||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(15)), | |||
), | |||
SizedBox( | |||
width: 10, | |||
) | |||
], | |||
); | |||
return Scaffold( | |||
@@ -141,105 +206,330 @@ class TranslationButlerPageState extends State<TranslationButlerPage> { | |||
body: SafeArea( | |||
child: Container( | |||
color: Color(0xffE8EAF0), | |||
child: ListView( | |||
children: <Widget>[ | |||
Padding( | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 15), | |||
child: Text( | |||
I18n.of(context).translation_butler_tips, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xffABABAB), fontSize: 13), | |||
), | |||
child: isApply ? applyPage() : waitPage(), | |||
), | |||
), | |||
); | |||
} | |||
Widget applyPage() { | |||
return ListView( | |||
children: <Widget>[ | |||
Padding( | |||
padding: EdgeInsets.only(left: 20, right: 10, top: 15), | |||
child: Text( | |||
I18n.of(context).translation_butler_tips, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xffABABAB), fontSize: 13), | |||
), | |||
), | |||
Container( | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
// side: BorderSide(color: Colors.green,width: 25), | |||
), | |||
child: Container( | |||
padding: EdgeInsets.all(10), | |||
child: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Padding( | |||
padding: EdgeInsets.only(bottom: 12), | |||
child: Text( | |||
I18n.of(context).choose_language, | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle( | |||
color: AppColors.NewAppbarTextColor, fontSize: 17), | |||
), | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Image.asset( | |||
R.assetsImagesImgTranslationIcon, | |||
width: 195, | |||
height: 175, | |||
), | |||
Column( | |||
mainAxisSize: MainAxisSize.min, | |||
children: <Widget>[ | |||
_langPopMenu(true), | |||
SizedBox(height: 14), | |||
InkWell( | |||
onTap: () { | |||
var temp = curSourceLang; | |||
curSourceLang = curToLang; | |||
curToLang = temp; | |||
setState(() {}); | |||
}, | |||
child: RotatedBox( | |||
quarterTurns: 1, | |||
child: Container( | |||
child: Icon( | |||
IconData( | |||
0xe669, | |||
fontFamily: Constants.IconFontFamily, | |||
), | |||
size: 24, | |||
color: Color(0xff4A5E76), | |||
), | |||
padding: EdgeInsets.symmetric( | |||
vertical: 5, horizontal: 5), | |||
), | |||
), | |||
), | |||
SizedBox(height: 14), | |||
_langPopMenu(false), | |||
], | |||
), | |||
], | |||
), | |||
Padding( | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 15), | |||
child: Text( | |||
I18n.of(context).translation_butler_rules, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xffABABAB), fontSize: 13), | |||
), | |||
), | |||
], | |||
), | |||
Container( | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
), | |||
), | |||
), | |||
Container( | |||
margin: EdgeInsets.only(left: 70, right: 70, top: 50), | |||
height: 47, | |||
child: RaisedButton( | |||
color: Color(0xff3875E9), | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10))), | |||
child: Text( | |||
I18n.of(context).translation_butler_call + ' (50h)', | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.white, fontSize: 19), | |||
), | |||
onPressed:(){ | |||
timeStamp = DateTime.now().millisecondsSinceEpoch; | |||
apply(); | |||
} ), | |||
) | |||
], | |||
); | |||
} | |||
Widget waitPage() { | |||
// ~/ 取整操作 | |||
int seconds = secondsPassed % 60; | |||
int minutes = secondsPassed ~/ 60; | |||
return ListView( | |||
children: <Widget>[ | |||
///当前排队人数过多。。。 | |||
Container( | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
// side: BorderSide(color: Colors.green,width: 25), | |||
), | |||
child: Container( | |||
// width: double.maxFinite, | |||
// color: Colors.blue, | |||
padding: EdgeInsets.fromLTRB(14, 14, 14, 22), | |||
child: Column( | |||
children: <Widget>[ | |||
Padding( | |||
padding: EdgeInsets.only(bottom: 20, top: 10), | |||
child: Text( | |||
I18n.of(context).translation_butler_tips2, | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle(color: Color(0xff797979), fontSize: 13), | |||
), | |||
), | |||
child: Container( | |||
padding: EdgeInsets.all(10), | |||
child: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
Container( | |||
width: double.maxFinite, | |||
child: Row( | |||
mainAxisSize: MainAxisSize.max, | |||
mainAxisAlignment: MainAxisAlignment.spaceAround, | |||
children: <Widget>[ | |||
Text( | |||
I18n.of(context).choose_language, | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle(color: AppColors.NewAppbarTextColor,fontSize: 17), | |||
), | |||
Row( | |||
Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
Image.asset( | |||
R.assetsImagesImgTranslationIcon, | |||
width: 195, | |||
height: 175, | |||
), | |||
Column( | |||
mainAxisSize: MainAxisSize.min, | |||
children: <Widget>[ | |||
_langPopMenu(true), | |||
SizedBox(width: 10), | |||
InkWell( | |||
onTap: () { | |||
var temp = curSourceLang; | |||
curSourceLang = curToLang; | |||
curToLang = temp; | |||
setState(() {}); | |||
}, | |||
child: Container( | |||
child: Icon( | |||
IconData( | |||
0xe669, | |||
fontFamily: Constants.IconFontFamily, | |||
), | |||
size: 12, | |||
), | |||
padding: EdgeInsets.symmetric( | |||
vertical: 5, horizontal: 5), | |||
), | |||
), | |||
SizedBox(width: 20), | |||
_langPopMenu(false), | |||
], | |||
fixedText( | |||
I18n.of(context).translation_butler_wait_people, | |||
fontSize: 16, | |||
color: Colors.black), | |||
SizedBox( | |||
height: 10, | |||
), | |||
RichText( | |||
maxLines: 3, | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: '333', | |||
style: TextStyle( | |||
color: Color(0xffFF1010), | |||
fontSize: 27)), | |||
TextSpan( | |||
text: ' ' + | |||
I18n.of(context) | |||
.translation_butler_wait_people_unit, | |||
style: TextStyle( | |||
color: Colors.black, fontSize: 17)), | |||
])) | |||
], | |||
), | |||
Padding( | |||
padding: EdgeInsets.only(left: 10, right: 10, top: 15), | |||
child: Text( | |||
I18n.of(context).translation_butler_rules, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xffABABAB), fontSize: 13), | |||
), | |||
Container( | |||
width: 1, | |||
height: 65, | |||
color: Color(0xffD8D8D8), | |||
), | |||
Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
fixedText( | |||
I18n.of(context).translation_butler_wait_time, | |||
fontSize: 16, | |||
color: Colors.black), | |||
SizedBox( | |||
height: 10, | |||
), | |||
RichText( | |||
maxLines: 3, | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: '666', | |||
style: TextStyle( | |||
color: Color(0xff3875E9), | |||
fontSize: 27)), | |||
TextSpan( | |||
text: ' ' + I18n.of(context).minute, | |||
style: TextStyle( | |||
color: Colors.black, fontSize: 17)), | |||
])) | |||
], | |||
), | |||
], | |||
), | |||
), | |||
), | |||
) | |||
], | |||
), | |||
Container( | |||
margin: EdgeInsets.only(left: 70, right: 70,top: 50), | |||
height: 47, | |||
child: RaisedButton( | |||
color: Color(0xff3875E9), | |||
shape:RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10)) | |||
), | |||
child: Text(I18n.of(context).translation_butler_call+' (50h)',textScaleFactor: 1.0,style: TextStyle(color: Colors.white,fontSize: 19),), | |||
onPressed: () { | |||
showToast( | |||
'呼叫管家${I18n.of(context).translation_butler_call}'); | |||
}), | |||
) | |||
], | |||
), | |||
), | |||
), | |||
), | |||
Padding( | |||
padding: EdgeInsets.only(left: 20, right: 10, top: 5,bottom: 10), | |||
child: Text( | |||
I18n.of(context).translation_butler_tips3, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.black, fontSize: 18), | |||
), | |||
), | |||
Stack(alignment: Alignment.center,children: <Widget>[ | |||
UnconstrainedBox(child: Container( | |||
//限制进度条的高度 | |||
height: 190.0, | |||
//限制进度条的宽度 | |||
width: 190.0, | |||
child: CircularProgressIndicator( | |||
//0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值 | |||
value: null, | |||
strokeWidth: 5, | |||
//背景颜色 | |||
backgroundColor: Color(0xffB2B2B2), | |||
//进度颜色 | |||
valueColor: AlwaysStoppedAnimation<Color>(Color(0xff3875E9))), | |||
),), | |||
Column(children: <Widget>[ | |||
Text( | |||
I18n.of(context).translation_butler_already_wait, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.black, fontSize: 19), | |||
), | |||
SizedBox(height: 10,), | |||
Text( | |||
getFull(minutes)+' : '+getFull(seconds) , | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xffFF1010), fontSize: 35), | |||
) | |||
],) | |||
],), | |||
Container( | |||
margin: EdgeInsets.only(left: 70, right: 70, top: 50), | |||
height: 47, | |||
child: RaisedButton( | |||
color: Color(0xff3875E9), | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10))), | |||
child: Text( | |||
I18n.of(context).translation_butler_cancel, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.white, fontSize: 19), | |||
), | |||
onPressed: () async{ | |||
await SPUtils.save(Constants.TranslationHelper,null); | |||
setState(() { | |||
isApply = true; | |||
timer?.cancel(); | |||
secondsPassed=0; | |||
}); | |||
}), | |||
), | |||
Container( | |||
margin: EdgeInsets.only(left: 70, right: 70, top: 25), | |||
height: 47, | |||
child: RaisedButton( | |||
color: Color(0xffB3B3B3), | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10))), | |||
child: Text( | |||
I18n.of(context).translation_butler_wait_service, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.white, fontSize: 19), | |||
), | |||
onPressed: () {}), | |||
) | |||
], | |||
); | |||
} | |||
bool isApply = true; | |||
int secondsPassed = 1; | |||
int timeStamp; | |||
Timer timer; | |||
void handleTick() { | |||
// if (isActive) { | |||
setState(() { | |||
secondsPassed = secondsPassed + 1; //需要更新UI | |||
}); | |||
// } | |||
} | |||
getFull(int sec){ | |||
return sec<10?'0$sec':'$sec'; | |||
} | |||
} |
@@ -15,6 +15,7 @@ import 'package:chat/utils/MessageMgr.dart'; | |||
import 'package:chat/utils/group_member_model.dart'; | |||
import 'package:chat/utils/msgHandler.dart'; | |||
import 'package:chat/utils/screen.dart'; | |||
import 'package:chat/utils/separator_line.dart'; | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; | |||
@@ -43,12 +44,10 @@ class TravelButlerPage extends StatefulWidget { | |||
} | |||
class TravelButlerPageState extends State<TravelButlerPage> { | |||
LocationResult startResult; | |||
LocationResult endResult; | |||
double distance=0.0; | |||
double distanceB=0.0; | |||
double distanceB = 0.0; | |||
@override | |||
void initState() { | |||
@@ -63,6 +62,9 @@ class TravelButlerPageState extends State<TravelButlerPage> { | |||
@override | |||
Widget build(BuildContext context) { | |||
List<String> disStr =getDistanceStr(distanceB).toString().split(' '); | |||
Widget appBar = AppBar( | |||
backgroundColor: AppColors.NewAppbarBgColor, | |||
title: Text( | |||
@@ -77,107 +79,221 @@ class TravelButlerPageState extends State<TravelButlerPage> { | |||
return Scaffold( | |||
appBar: appBar, | |||
body: SafeArea( | |||
child: ListView( | |||
children: <Widget>[ | |||
InkWell( | |||
child: Text( | |||
I18n.of(context).travel_butler+'起点', | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: AppColors.NewAppbarTextColor,fontSize: 30), | |||
), | |||
onTap: () async{ | |||
startResult =await _openMap(context); | |||
}, | |||
), | |||
InkWell( | |||
child: Text( | |||
I18n.of(context).travel_butler+'终点', | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: AppColors.NewAppbarTextColor,fontSize: 30), | |||
), | |||
onTap: () async{ | |||
endResult = await _openMap(context); | |||
}, | |||
), | |||
InkWell( | |||
child: Text( | |||
'距离查询', | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: AppColors.NewAppbarTextColor,fontSize: 30), | |||
child: Container( | |||
color: Color(0xffE8EAF0), | |||
child: ListView( | |||
children: <Widget>[ | |||
Container( | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
// side: BorderSide(color: Colors.green,width: 25), | |||
), | |||
child: Container( | |||
// width: double.maxFinite, | |||
// color: Colors.blue, | |||
padding: EdgeInsets.all(14), | |||
child: Row( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
// mainAxisAlignment: MainAxisAlignment.spaceAround, | |||
mainAxisSize: MainAxisSize.max, | |||
children: <Widget>[ | |||
Column( | |||
children: <Widget>[ | |||
SizedBox(height: 17,), | |||
ClipOval( | |||
child: Container( | |||
padding: EdgeInsets.all(4), | |||
child: ClipOval( | |||
child: Container( | |||
color: Colors.white, | |||
width: 5,height: 5, | |||
), | |||
), | |||
// decoration: BoxDecoration( | |||
// color: Color(0xff3875E9), | |||
// border: Border.all( | |||
// color: Color(0xff3875E9), width: 3)), | |||
color: Color(0xff3875E9), | |||
width: 17,height: 17, | |||
), | |||
), | |||
Padding(padding: EdgeInsets.only(top: 5,bottom: 5),child: MySeparator(color: Color(0xffDADCDE)),), | |||
ClipOval( | |||
child: Container( | |||
padding: EdgeInsets.all(4), | |||
child: ClipOval( | |||
child: Container( | |||
color: Colors.white, | |||
width: 5,height: 5, | |||
), | |||
), | |||
// decoration: BoxDecoration( | |||
// color: Color(0xff3875E9), | |||
// border: Border.all( | |||
// color: Color(0xff3875E9), width: 3)), | |||
color: Color(0xffFF1010), | |||
width: 17,height: 17, | |||
), | |||
), | |||
], | |||
), | |||
SizedBox(width: 12,), | |||
Expanded(child: Container( child: Column(mainAxisSize: MainAxisSize.max,children: <Widget>[ | |||
InkWell(child: positionLayout(true),onTap: ()async{ | |||
startResult = await _openMap(context); | |||
print('ddddd: $startResult'); | |||
setState(() { | |||
}); | |||
},), | |||
Container(color: Color(0xffD8D8D8),height: 0.8,width: double.maxFinite,), | |||
InkWell(child: positionLayout(false),onTap: ()async{ | |||
endResult = await _openMap(context); | |||
setState(() { | |||
}); | |||
},), | |||
],),)) | |||
], | |||
), | |||
), | |||
), | |||
), | |||
onTap: () async{ | |||
if(startResult!=null && endResult!=null){ | |||
distanceB =await Geolocator().distanceBetween(startResult.latLng.latitude,startResult.latLng.longitude,endResult.latLng.latitude,endResult.latLng.longitude); | |||
setState(() { | |||
print('开始计算'); | |||
distance =getDistance(startResult.latLng.latitude,startResult.latLng.longitude,endResult.latLng.latitude,endResult.latLng.longitude); | |||
Padding( | |||
padding: EdgeInsets.only(left: 15,right: 15,bottom: 20,top: 13), | |||
child: Text( | |||
I18n.of(context).travel_tips, | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle( | |||
color: Color(0xff797979), fontSize: 11), | |||
), | |||
), | |||
}); | |||
}else{ | |||
print('参数为空'); | |||
} | |||
Container( | |||
margin: EdgeInsets.only(left: 70, right: 70 ,bottom: 30), | |||
height: 47, | |||
child: RaisedButton( | |||
color: Color(0xff3875E9), | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10))), | |||
child: Text( | |||
I18n.of(context).travel_check_distance, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Colors.white, fontSize: 19), | |||
), | |||
onPressed: () async{ | |||
if (startResult != null && endResult != null) { | |||
distanceB = await Geolocator().distanceBetween( | |||
startResult.latLng.latitude, | |||
startResult.latLng.longitude, | |||
endResult.latLng.latitude, | |||
endResult.latLng.longitude); | |||
setState(() { | |||
}); | |||
} | |||
}), | |||
), | |||
}, | |||
), | |||
Container( | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
// side: BorderSide(color: Colors.green,width: 25), | |||
), | |||
child: Container( | |||
// width: double.maxFinite, | |||
// color: Colors.blue, | |||
padding: EdgeInsets.all(14), | |||
child: Column(children: <Widget>[ | |||
SizedBox(height: 21,), | |||
Text( | |||
I18n.of(context).travel_check_distance_result, | |||
textScaleFactor: 1.0, | |||
style: TextStyle(color: Color(0xff797979), fontSize: 16), | |||
), | |||
Padding(padding: EdgeInsets.only(top: 25,bottom: 25),child: RichText( | |||
maxLines: 3, | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: disStr[0], | |||
style: TextStyle( | |||
color: Color(0xffFF1010), | |||
fontSize: 25)), | |||
TextSpan( | |||
text: ' '+disStr[1], | |||
style: TextStyle( | |||
color: Color(0xff6F4A5D), | |||
fontSize: 17)), | |||
])),) | |||
],), | |||
), | |||
), | |||
), | |||
// Text('距离为: ${getDistanceStr(distance)}'), | |||
// Text('距离为: ${getDistanceStr(distanceB)}') | |||
Text('距离为: $distance'), | |||
Text('距离为: $distanceB'), | |||
], | |||
], | |||
), | |||
), | |||
), | |||
); | |||
} | |||
getDistanceStr(double m){ | |||
Widget positionLayout(bool isStart){ | |||
if(m<1000){ | |||
return '${m.toInt()} M'; | |||
}else{ | |||
return '${(m/1000).toStringAsFixed(2)} KM'; | |||
String str = isStart?'我的位置':'你要去哪儿'; | |||
if(isStart && startResult!=null && startResult.address!=null){ | |||
str = startResult.address; | |||
}else if (!isStart && endResult!=null &&endResult.address!=null){ | |||
str = endResult.address; | |||
} | |||
} | |||
return Container(height:50,child: Row(mainAxisSize: MainAxisSize.max, children: <Widget>[ | |||
Expanded(child: Container( child: fixedText(str,color: Colors.black,fontSize: 16),)), | |||
fixedText(isStart?'起点':'终点',color: Color(0xff797979),fontSize: 14) | |||
],),); | |||
getDistance(double lat1, double lng1, double lat2, double lng2) { | |||
double radLat1 = rad(lat1); | |||
double radLat2 = rad(lat2); | |||
double a = radLat1 - radLat2; | |||
double b = rad(lng1) - rad(lng2); | |||
double s = 2 * | |||
asin(sqrt(pow(sin(a / 2), 2) + | |||
cos(radLat1) * cos(radLat2) * pow(sin(b / 2), 2))); | |||
return s * 6378138.0; | |||
} | |||
double rad(double d) { | |||
return d * pi / 180.0; | |||
getDistanceStr(double m) { | |||
if (m < 1000) { | |||
return '${m.toInt()} M'; | |||
} else { | |||
return '${(m / 1000).toStringAsFixed(2)} KM'; | |||
} | |||
} | |||
_openMap(BuildContext context) async { | |||
_openMap(BuildContext context) async { | |||
if (await CustomUI.showPermissionSetting( | |||
context, PermissionGroup.location, I18n.of(context).open_location)) { | |||
return LocationPicker.pickLocation( | |||
return LocationPicker.pickLocation( | |||
context, 'AIzaSyAb9JNtW0BEZ_qLeDg87ZhvxSmZply-7hU', | |||
initialCenter: LatLng(UserData().latitude, UserData().longitude)); | |||
// print('地图结果 ${result}'); | |||
// return result; | |||
} | |||
} | |||
} |
@@ -14,6 +14,7 @@ import 'package:chat/utils/screen.dart'; | |||
import 'package:dio/dio.dart'; | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/painting.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:oktoast/oktoast.dart'; | |||
import 'package:permission_handler/permission_handler.dart'; | |||
@@ -26,6 +27,7 @@ import 'PicSwiper.dart'; | |||
import 'TutorialOverlay.dart'; | |||
import 'app_navigator.dart'; | |||
import 'conversation_table.dart'; | |||
import 'count_down_button.dart'; | |||
class NoKeyboardEditableTextFocusNode extends FocusNode { | |||
// @override | |||
@@ -1244,4 +1246,72 @@ class CustomUI { | |||
), | |||
); | |||
} | |||
static void buildTranslationHelperOrderDialog(BuildContext context) { | |||
Navigator.of(context).push(TutorialOverlay( | |||
child: | |||
InkWell(onTap: (){Navigator.of(context).pop();},child: UnconstrainedBox(alignment: Alignment.topCenter,child: InkWell(onTap: (){},child: | |||
Container( | |||
alignment: Alignment.topCenter, | |||
// height: 180, | |||
width: Screen.width-20, | |||
margin: EdgeInsets.all(10), | |||
child: Card( | |||
elevation: 5, // 阴影 | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.circular(10), | |||
// side: BorderSide(color: Colors.green,width: 25), | |||
), | |||
child: Container( | |||
// color: Colors.yellow, | |||
width: double.maxFinite, | |||
padding: EdgeInsets.all(16), | |||
child: Column( | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Padding( | |||
padding: EdgeInsets.only(bottom: 15), | |||
child: Text( | |||
I18n.of(context).translation_butler_dialog_title, | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle( | |||
fontWeight: FontWeight.w500, | |||
color: AppColors.NewAppbarTextColor, fontSize: 17), | |||
), | |||
), | |||
Text( | |||
I18n.of(context).translation_butler_dialog_order.replaceAll('s1', 'xxx'), | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle( | |||
color: AppColors.NewAppbarTextColor, fontSize: 14), | |||
), | |||
SizedBox(height: 10,), | |||
Text( | |||
'时间:今天11:45 时长:10分钟', | |||
textScaleFactor: 1.0, | |||
textAlign: TextAlign.left, | |||
style: TextStyle( | |||
color: AppColors.NewAppbarTextColor, fontSize: 14), | |||
), | |||
CountDownButton( I18n.of(context).translation_butler_dialog_start_service,(){ | |||
Navigator.of(context).pop(); | |||
}), | |||
], | |||
), | |||
), | |||
), | |||
),),),),)); | |||
} | |||
} |
@@ -0,0 +1,96 @@ | |||
import 'dart:async'; | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
class CountDownButton extends StatefulWidget{ | |||
final String text; | |||
final Function callBack; | |||
CountDownButton(this.text,this.callBack); | |||
@override | |||
State<StatefulWidget> createState() { | |||
// TODO: implement createState | |||
return CountDownButtonState(); | |||
} | |||
} | |||
class CountDownButtonState extends State<CountDownButton> { | |||
int secondsPassed = 5*60; | |||
// int secondsPassed =10; | |||
Timer timer; | |||
void handleTick() { | |||
// if (isActive) { | |||
if(secondsPassed==1){ | |||
widget.callBack(); | |||
timer?.cancel(); | |||
return; | |||
} | |||
setState(() { | |||
secondsPassed = secondsPassed - 1; //需要更新UI | |||
}); | |||
// } | |||
} | |||
getFull(int sec){ | |||
return sec<10?'0$sec':'$sec'; | |||
} | |||
@override | |||
void initState() { | |||
// TODO: implement initState | |||
super.initState(); | |||
timer = Timer.periodic(Duration(seconds: 1), (Timer t){ | |||
handleTick(); | |||
}); | |||
} | |||
@override | |||
void dispose() { | |||
// TODO: implement dispose | |||
super.dispose(); | |||
timer?.cancel(); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
// TODO: implement build | |||
// ~/ 取整操作 | |||
int seconds = secondsPassed % 60; | |||
int minutes = secondsPassed ~/ 60; | |||
return Container( | |||
alignment: Alignment.center, | |||
margin: EdgeInsets.only(left: 30, right: 30, top: 20,bottom: 20), | |||
height: 48, | |||
child: RaisedButton( | |||
color: Color(0xff3875E9), | |||
shape: RoundedRectangleBorder( | |||
borderRadius: BorderRadius.all(Radius.circular(10))), | |||
child: RichText( | |||
maxLines: 1, | |||
textAlign: TextAlign.center, | |||
text: TextSpan(children: [ | |||
TextSpan( | |||
text: widget.text, | |||
style: TextStyle( | |||
color: Colors.white, | |||
fontSize: 18)), | |||
TextSpan( | |||
text:' ('+ getFull(minutes)+' : '+getFull(seconds)+')', | |||
style: TextStyle( | |||
color: Colors.white, fontSize: 14)), | |||
])) , | |||
onPressed: () async{ | |||
}), | |||
); | |||
} | |||
} | |||
@@ -0,0 +1,33 @@ | |||
import 'package:flutter/material.dart'; | |||
class MySeparator extends StatelessWidget { | |||
final double height; | |||
final Color color; | |||
const MySeparator({this.height = 1.6, this.color = Colors.black}); | |||
@override | |||
Widget build(BuildContext context) { | |||
return Container(child: RotatedBox(child: LayoutBuilder( | |||
builder: (BuildContext context, BoxConstraints constraints) { | |||
final boxWidth = constraints.constrainWidth(); | |||
final dashWidth = height; | |||
final dashHeight = 1.5; | |||
final dashCount = (boxWidth / (2 * dashWidth)).floor(); | |||
return Flex( | |||
children: List.generate(dashCount, (_) { | |||
return SizedBox( | |||
width: dashWidth, | |||
height: dashHeight, | |||
child: DecoratedBox( | |||
decoration: BoxDecoration(color: color), | |||
), | |||
); | |||
}), | |||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||
direction: Axis.horizontal, | |||
); | |||
}, | |||
),quarterTurns: 1,),height: 26,); | |||
} | |||
} |