Explorar el Código

地图详情部分

周睿 hace 2 años
padre
commit
2517603a72

+ 1 - 4
lib/generated/google/protobuf/any.pb.dart

@@ -38,10 +38,6 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
 ///      if (any.is(Foo.class)) {
 ///        foo = any.unpack(Foo.class);
 ///      }
-///      // or ...
-///      if (any.isSameTypeAs(Foo.getDefaultInstance())) {
-///        foo = any.unpack(Foo.getDefaultInstance());
-///      }
 ///
 ///   Example 3: Pack and unpack a message in Python.
 ///
@@ -72,6 +68,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
 ///  in the type URL, for example "foo.bar.com/x/y.z" will yield type
 ///  name "y.z".
 ///
+///
 ///  JSON
 ///  ====
 ///  The JSON representation of an `Any` value uses the regular

+ 3 - 1
lib/generated/google/protobuf/timestamp.pb.dart

@@ -65,6 +65,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
 ///      Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
 ///          .setNanos((int) ((millis % 1000) * 1000000)).build();
 ///
+///
 ///  Example 5: Compute Timestamp from Java `Instant.now()`.
 ///
 ///      Instant now = Instant.now();
@@ -73,6 +74,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
 ///          Timestamp.newBuilder().setSeconds(now.getEpochSecond())
 ///              .setNanos(now.getNano()).build();
 ///
+///
 ///  Example 6: Compute Timestamp from current time in Python.
 ///
 ///      timestamp = Timestamp()
@@ -102,7 +104,7 @@ import 'package:protobuf/src/protobuf/mixins/well_known.dart' as $mixin;
 ///  [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
 ///  the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
 ///  the Joda Time's [`ISODateTimeFormat.dateTime()`](
-///  http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()
+///  http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
 ///  ) to obtain a formatter capable of generating timestamps in this format.
 class Timestamp extends $pb.GeneratedMessage with $mixin.TimestampMixin {
   factory Timestamp({

+ 1 - 0
lib/utils.dart

@@ -1,6 +1,7 @@
 import 'dart:io';
 import 'dart:typed_data';
 
+import 'package:application/logger.dart';
 import 'package:f_cache/manager.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';

+ 4 - 12
lib/view/home/map/map_page.dart

@@ -1,12 +1,9 @@
 import 'package:application/service/map_watch.dart';
 import 'package:common_pub/model/distance.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
 import '../../../service/api.dart' as api;
 import '../../../utils.dart';
 import 'package:common_pub/model/position.dart' as m;
-import '../../../generated/assets.dart';
-import '../../../widget/app_net_image.dart';
+import '../../../widget.dart';
 
 typedef MapInfo = api.ToMapSimpleV2;
 
@@ -65,15 +62,10 @@ class MapPage extends StatelessWidget {
                 color: Colors.white, borderRadius: BorderRadius.circular(16)),
             child: Column(
               children: [
-                Row(
+                const Row(
                   children: [
-                    Container(
-                      width: 14,
-                      height: 14,
-                      decoration: const BoxDecoration(
-                          shape: BoxShape.circle, color: Colors.blue),
-                    ),
-                    const Text('地图列表'),
+                    TitlePoint(),
+                    Text(' 地图列表'),
                   ],
                 ),
                 Expanded(

+ 91 - 1
lib/view/home/user_manage/user_manage_controller.dart

@@ -1,5 +1,95 @@
-import 'package:get/get.dart';
+import 'package:application/service/api.dart';
+import 'package:application/service/map_watch.dart';
+import 'package:application/utils.dart';
+
+import '../../../widget.dart';
+
+
+enum Flag{
+  red, yellow, blue,
+
+  ;
+
+  Color color(){
+    return switch(this){
+      red=> Colors.red,
+      yellow=> Colors.yellow,
+      blue=>Colors.blue,
+    };
+  }
+}
+
+class ActiveInfo{
+  var id=0;
+  var name = '';
+  var userList = <UserInfo>[];
+}
+extension ToActionInfoExt on ToActionInfo{
+  ActiveInfo toActiveInfo(){
+    return ActiveInfo()
+      ..id=actId
+      ..name=actName
+      ..userList=userList.map((e) => e.toUserInfo()).toList();
+  }
+}
+
+class UserInfo{
+  var index = 0;
+  late String name;
+  DateTime? startAt;
+  final _isNotShow = false.obs;
+  final _flag = Flag.red.obs;
+  bool get isNotShow => _isNotShow.value;
+  set isNotShow(bool v){
+    _isNotShow.value = v;
+  }
+  Flag get flag => _flag.value;
+  set flag(Flag v){
+    _flag.value = v;
+  }
+}
+extension ToOrienteerInGameInfoExt on ToOrienteerInGameInfo{
+  UserInfo toUserInfo(){
+    return UserInfo()
+      ..name=baseInfo.name
+      ..startAt=gameSaveInfo.hasStartAt()? gameSaveInfo.startAt.toDateTime(toLocal: true): null;
+  }
+}
+
 
 class UserManageController extends GetxController{
+  @override
+  void onInit() {
+    super.onInit();
+    flushData();
+  }
+
+  Future<void> flushData()async{
+    await tryApi(() async{
+      final r = await ApiService.to.stub.toUserDetailQueryV2(ToUserDetailQueryRequestV2()
+        ..mapId=MapWatchService.instance?.id.toInt()??0
+        ..isFullQuery=false);
+      activeList.value = r.list.map((e) => e.toActiveInfo()).toList();
+      activeList.value = [
+        ActiveInfo()
+          ..id=1
+          ..name='穿越荒野:勇闯野性之旅'
+          ..userList.addAll([
+            UserInfo()
+              ..index=0
+              ..name='123',
+            UserInfo()
+              ..index=1
+              ..name='431'
+              ..startAt = DateTime.now(),
+          ]),
+        ActiveInfo()
+          ..id=2
+          ..name='极限挑战 战胜重力'
+      ];
+    });
+  }
 
+  final activeList = <ActiveInfo>[].obs;
+  final Rx<ActiveInfo?> selectActive = Rx(null);
 }

+ 184 - 5
lib/view/home/user_manage/user_manage_page.dart

@@ -1,23 +1,202 @@
 import 'user_manage_controller.dart';
 import 'package:application/widget.dart';
 
-class UserManagePage extends StatelessWidget{
+class UserManagePage extends StatelessWidget {
   const UserManagePage({super.key});
 
   @override
   Widget build(BuildContext context) {
     return GetBuilder(
-      init: UserManageController(),
-        builder: (c){
+        init: UserManageController(),
+        builder: (c) {
           return Container(
             width: double.infinity,
             height: double.infinity,
             margin: const EdgeInsets.all(20),
-            padding: const EdgeInsets.fromLTRB(58, 28, 58, 28),
+            padding: const EdgeInsets.fromLTRB(12, 17, 12, 17),
             decoration: BoxDecoration(
                 color: Colors.white, borderRadius: BorderRadius.circular(16)),
+            child: Row(
+              children: [
+                SizedBox(
+                    width: 260,
+                    height: double.infinity,
+                    child: Obx(() => eActiveList(context, c))),
+                const VerticalDivider(
+                    width: 15, color: Color(0xffd8d8d8), thickness: 1),
+                Expanded(child: Obx(() => eUserList(context, c)))
+              ],
+            ),
           );
         });
   }
 
-}
+  Widget eActiveList(BuildContext context, UserManageController c) {
+    return Column(
+      children: [
+        Row(
+          children: [
+            const Padding(padding: EdgeInsets.all(8), child: TitlePoint()),
+            const Text('活动列表'),
+            const Spacer(),
+            Container(
+              decoration: BoxDecoration(
+                  border: Border.all(color: const Color(0xffe3e3e3))),
+              child: const Text('2023-06-26'),
+            )
+          ],
+        ),
+        const SizedBox(height: 20),
+        Expanded(
+            child: ListView(
+          children: c.activeList
+              .map((e) => wActiveCard(
+                      context, e, c.selectActive.value?.id == e.id, () {
+                    c.selectActive.value = e;
+                  }))
+              .toList(),
+        )),
+      ],
+    );
+  }
+
+  Widget wActiveCard(BuildContext context, ActiveInfo active, bool selected,
+      VoidCallback onTap) {
+    return GestureDetector(
+        onTap: onTap,
+        child: Container(
+          decoration: const BoxDecoration(color: Colors.white, boxShadow: [
+            BoxShadow(color: Color(0x4d000000), blurRadius: 3.5)
+          ]),
+          height: _cardHeight,
+          width: double.infinity,
+          margin: const EdgeInsets.only(top: 7),
+          padding: const EdgeInsets.only(right: 11),
+          child: Row(
+            children: [
+              Container(
+                margin: const EdgeInsets.only(right: 10),
+                height: double.infinity,
+                width: 6.4,
+                color: selected ? const Color(0xffff870d) : Colors.transparent,
+              ),
+              Text(active.name),
+              const Spacer(),
+              Text(active.userList.length.toString())
+            ],
+          ),
+        ));
+  }
+
+  Widget eUserList(BuildContext context, UserManageController c) {
+    final active = c.selectActive.value;
+
+    if (active == null) {
+      return const SizedBox();
+    }
+
+    final userList = c.selectActive.value?.userList??<UserInfo>[];
+
+
+    return Column(
+      children: [
+        Row(
+          children: [
+            const Padding(padding: EdgeInsets.all(8), child: TitlePoint()),
+            const Text('用户列表'),
+            Text(' (${active.name})',
+                style: const TextStyle(color: Color(0xff949494))),
+          ],
+        ),
+        Expanded(child: Padding(
+            padding: EdgeInsets.all(18),
+            child: Column(
+              children: [
+                eUserListTitle(context),
+                Expanded(child: ListView(
+                  children:userList.indexed.map<Widget>((t){
+                    return eUserCard(context, c, t.$1+1, t.$2);
+                  }).toList(),
+                ))
+              ],
+            )
+        ))
+      ],
+    );
+  }
+  Widget eUserListTitle(BuildContext context){
+    return Row(
+      children: [
+        SizedBox(width: _userIndexWidth, child: Text('序号', textAlign: TextAlign.center)),
+        VerticalDivider(color: Colors.transparent),
+        SizedBox(width: _userNameWidth, child: Text('用户名', textAlign: TextAlign.center)),
+        VerticalDivider(color: Colors.transparent),
+        Expanded(child: Text('开始时间')),
+        VerticalDivider(color: Colors.transparent),
+        SizedBox(width: _userIsNotShowWidth, child: Text('是否屏蔽', textAlign: TextAlign.center)),
+        VerticalDivider(color: Colors.transparent),
+        SizedBox(width: _userFlagWidth, child: Row(
+          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+          children: Flag.values.map((e) => Icon(Icons.flag, color: e.color())).toList()
+        )),
+      ],
+    );
+  }
+  Widget eUserCard(
+      BuildContext context, UserManageController c, int index, UserInfo data) {
+
+    var startAt = '--';
+    if(data.startAt!= null){
+      startAt = data.startAt!.toIso8601String();
+    }
+
+    return Container(
+      height: _cardHeight,
+      width: double.infinity,
+      margin: const EdgeInsets.only(top: 3),
+      padding: const EdgeInsets.only(top: 10, bottom: 10),
+      decoration: const BoxDecoration(
+          color: Colors.white,
+          boxShadow: [BoxShadow(color: Color(0x4d000000), blurRadius: 0.7)]),
+      child: Row(children: [
+        SizedBox(width: _userIndexWidth, child: Text(index.toString(), textAlign: TextAlign.center,)),
+        const VerticalDivider(),
+        SizedBox(width: _userNameWidth, child: Text(data.name, textAlign: TextAlign.center,)),
+        const VerticalDivider(),
+        Expanded(child: Text(startAt)),
+        const VerticalDivider(),
+        Container(
+          width: _userIsNotShowWidth,
+          alignment: Alignment.center,
+          child: Checkbox(
+            value: data.isNotShow,
+            onChanged: (v){
+              if(v != null){
+                data.isNotShow=v;
+              }
+            },
+          ),
+        ),
+        const VerticalDivider(),
+        SizedBox(width: _userFlagWidth, child: Row(
+          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+          children: Flag.values.map((e) => Radio<Flag>(
+            value: e,
+            groupValue: data.flag,
+            onChanged: (Flag? value) {
+              if(value!= null){
+                data.flag=value;
+              }
+            },
+          )).toList()
+        )),
+      ]),
+    );
+  }
+  static const _userIndexWidth = 34.0;
+  static const _userNameWidth = 100.0;
+  static const _userIsNotShowWidth = 70.0;
+  static const _userFlagWidth = 170.0;
+  static const _cardHeight = 42.0;
+
+}

+ 2 - 1
lib/widget.dart

@@ -1,4 +1,5 @@
 export 'package:flutter/material.dart';
 export 'generated/assets.dart';
 export 'package:get/get.dart';
-export 'widget/app_net_image.dart';
+export 'widget/app_net_image.dart';
+export 'widget/title_point.dart';

+ 14 - 0
lib/widget/title_point.dart

@@ -0,0 +1,14 @@
+import 'package:flutter/material.dart';
+
+
+class TitlePoint extends StatelessWidget{
+  const TitlePoint({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    return const CircleAvatar(
+        backgroundColor: Colors.blue,
+        radius: 5);
+  }
+
+}

+ 1 - 1
protos/app_api

@@ -1 +1 @@
-Subproject commit 66af3208947157816cbe8b01f4e914537ead9c14
+Subproject commit bbb1a6727d8643906a2949c9c3333a6da8e7135a

+ 1 - 1
third_party/common_pub

@@ -1 +1 @@
-Subproject commit 8a57ff30188327efba31dc87325aaa9d719990f5
+Subproject commit 195aa65bee16dea43f03522f00421d62b9d29ba2