| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- import 'package:abroad_location/base/base_controller.dart';
- import 'package:get/get.dart';
- import 'package:injectable/injectable.dart';
- import 'package:sliding_sheet2/sliding_sheet2.dart';
- import '../../data/bean/user_info.dart';
- @injectable
- class LocationController extends BaseController {
- SheetController sheetController = SheetController();
- final RxDouble _sheetProgress = 0.0.obs;
- double get sheetProgress => _sheetProgress.value;
- final Rxn<UserInfo> _selectUserInfo = Rxn();
- UserInfo? get selectUserInfo => _selectUserInfo.value;
- final RxList<UserInfo> locationFriendList = RxList();
- final RxBool _isFindContact = false.obs;
- bool get isFindContact => _isFindContact.value;
- final findContactAnimatedDuration = const Duration(milliseconds: 250);
- @override
- void onReady() {
- super.onReady();
- //*******测试*******
- for (int i = 0; i < 20; i++) {
- locationFriendList.add(UserInfo(
- id: 'id$i',
- phoneNumber: 'phoneNumber$i',
- remark: 'remark$i',
- timestamp: 1234567890,
- blockedHim: false,
- blockedMe: false,
- virtual: false,
- isMine: false,
- ));
- }
- _selectUserInfo.value = locationFriendList[0];
- //**********
- }
- setSheetProgress(double progress) {
- _sheetProgress.value = progress;
- }
- onSelectItemClick(UserInfo userInfo) async {
- _selectUserInfo.value = userInfo;
- await sheetController.scrollTo(0, duration: Duration(milliseconds: 1));
- sheetController.snapToExtent(0, duration: Duration(milliseconds: 350));
- }
- void onFindContactClick() {
- _isFindContact.value = !isFindContact;
- }
- }
|