2 Revīzijas 07afe212e5 ... 74ed8fcdd7

Autors SHA1 Ziņojums Datums
  arthur.wu 74ed8fcdd7 Merge branch 'master' of http://git.ius.plus/Project-Wing/WingCloudServer 1 gadu atpakaļ
  arthur.wu 0beb290f5e adjust ui 1 gadu atpakaļ
1 mainītis faili ar 201 papildinājumiem un 180 dzēšanām
  1. 201 180
      Tools/Flyinsono.Deployment/lib/PackageView.dart

+ 201 - 180
Tools/Flyinsono.Deployment/lib/PackageView.dart

@@ -337,205 +337,226 @@ class _FullScreenDialogDemo extends StatelessWidget {
         removeTop: true,
         removeBottom: true,
         child: Scaffold(
-          appBar: AppBar(
-            title: Text(detail.id == '' ? 'Add Package' : 'Edit Package'),
-            actions: [
-              TextButton(
-                onPressed: () {
-                  detail.upgradeInfos = upgradeInfos;
-                  onSavePressed(detail);
-                  Navigator.pop(context);
-                },
-                child: Text(
-                  localizations.submit,
-                  style: theme.textTheme.bodyMedium!.copyWith(
-                    color: theme.colorScheme.onPrimary,
+            appBar: AppBar(
+              title: Text(detail.id == '' ? 'Add Package' : 'Edit Package'),
+              actions: [
+                TextButton(
+                  onPressed: () {
+                    detail.upgradeInfos = upgradeInfos;
+                    onSavePressed(detail, context);
+                  },
+                  child: Text(
+                    localizations.submit,
+                    style: theme.textTheme.bodyMedium!.copyWith(
+                      color: theme.colorScheme.onPrimary,
+                    ),
                   ),
                 ),
-              ),
-            ],
-          ),
-          body: StatefulBuilder(builder: (BuildContext context, setState) {
-            return SingleChildScrollView(
-              child: Column(
-                crossAxisAlignment: CrossAxisAlignment.start,
-                mainAxisSize: MainAxisSize.min,
-                children: <Widget>[
-                  Row(
-                    children: [
-                      Flexible(
-                        flex: 1,
-                        child: SizedBox(
-                            width: 280,
-                            child: TextField(
-                              textAlignVertical: TextAlignVertical.top,
-                              controller: _version,
+              ],
+            ),
+            body: Padding(
+              padding: EdgeInsets.all(16.0),
+              child: StatefulBuilder(builder: (BuildContext context, setState) {
+                return SingleChildScrollView(
+                  child: Column(
+                    crossAxisAlignment: CrossAxisAlignment.start,
+                    mainAxisSize: MainAxisSize.min,
+                    children: <Widget>[
+                      Row(
+                        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
+                        children: [
+                          Expanded(
+                              child: Column(
+                            crossAxisAlignment: CrossAxisAlignment.start,
+                            children: [
+                              Text(
+                                localizations.version,
+                                textAlign: TextAlign.left,
+                              ),
+                              SizedBox(
+                                height: 10,
+                              ),
+                              SizedBox(
+                                  width: 280,
+                                  child: TextField(
+                                    textAlignVertical: TextAlignVertical.top,
+                                    controller: _version,
+                                    decoration: InputDecoration(
+                                      contentPadding: EdgeInsets.symmetric(
+                                          vertical: 0, horizontal: 10),
+                                      border: OutlineInputBorder(
+                                        borderRadius:
+                                            BorderRadius.circular(5.0),
+                                      ),
+                                    ),
+                                    onChanged: (String? newValue) {
+                                      // 在这里处理下拉框选项更改事件
+                                      setState(() {
+                                        detail.version = newValue;
+                                      });
+                                    },
+                                  )),
+                            ],
+                          )),
+                          Expanded(
+                              child: Column(
+                            crossAxisAlignment: CrossAxisAlignment.start,
+                            children: [
+                              Text(
+                                localizations.releasedBy,
+                                textAlign: TextAlign.left,
+                              ),
+                              SizedBox(
+                                height: 10,
+                              ),
+                              SizedBox(
+                                  width: 280,
+                                  child: DecoratedBox(
+                                    decoration: BoxDecoration(
+                                      color: Colors.blue,
+                                      border: Border.all(
+                                        color: Colors.black,
+                                        width: 1,
+                                      ),
+                                      borderRadius: BorderRadius.circular(5),
+                                    ),
+                                    child: DropdownButton<String>(
+                                      alignment: Alignment.center,
+                                      underline: const SizedBox(),
+                                      isExpanded: true, // 添加这个属性使宽度自适应
+                                      value: operatorItems
+                                              .contains(detail.releasedBy)
+                                          ? detail.releasedBy
+                                          : null,
+                                      items: operatorItems
+                                          .map<DropdownMenuItem<String>>(
+                                        (String value) {
+                                          return DropdownMenuItem<String>(
+                                            value: value,
+                                            child: Text(value),
+                                          );
+                                        },
+                                      ).toList(),
+                                      onChanged: (String? newValue) {
+                                        // 在这里处理下拉框选项更改事件
+                                        setState(() {
+                                          detail.releasedBy = newValue;
+                                        });
+                                      },
+                                    ),
+                                  ))
+                            ],
+                          )),
+                        ],
+                      ),
+                      SizedBox(height: 40),
+                      Column(
+                          crossAxisAlignment: CrossAxisAlignment.start,
+                          children: [
+                            Text(localizations.internalRecord),
+                            SizedBox(height: 10),
+                            TextField(
+                              controller: _internalRecord,
                               decoration: InputDecoration(
-                                labelText: 'Version',
-                                contentPadding: EdgeInsets.symmetric(
-                                    vertical: 0, horizontal: 10),
+                                border: OutlineInputBorder(
+                                  borderRadius: BorderRadius.circular(5.0),
+                                ),
                               ),
+                              maxLines: 8, // 允许多行输入
+                              keyboardType: TextInputType.multiline,
                               onChanged: (String? newValue) {
                                 // 在这里处理下拉框选项更改事件
                                 setState(() {
-                                  detail.version = newValue;
+                                  detail.internalRecord = newValue;
                                 });
                               },
-                            )),
-                      ),
-                      SizedBox(width: 40), // 添加间距
-                      Flexible(
-                          flex: 1,
-                          child: SizedBox(
-                              width: 280,
-                              child: DecoratedBox(
-                                decoration: BoxDecoration(
-                                  color: Colors.blue,
-                                  border: Border.all(
-                                    color: Colors.black,
-                                    width: 1,
-                                  ),
-                                  borderRadius: BorderRadius.circular(5),
-                                ),
-                                child: DropdownButton<String>(
-                                  underline: const SizedBox(),
-                                  isExpanded: true, // 添加这个属性使宽度自适应
-                                  value:
-                                      operatorItems.contains(detail.releasedBy)
-                                          ? detail.releasedBy
-                                          : null,
-                                  hint: Text(
-                                    'ReleasedBy',
-                                    style: new TextStyle(color: Colors.white),
-                                  ),
-                                  items: operatorItems
-                                      .map<DropdownMenuItem<String>>(
-                                    (String value) {
-                                      return DropdownMenuItem<String>(
-                                        value: value,
-                                        child: Text(value),
-                                      );
-                                    },
-                                  ).toList(),
-                                  onChanged: (String? newValue) {
-                                    // 在这里处理下拉框选项更改事件
-                                    setState(() {
-                                      detail.releasedBy = newValue;
-                                    });
-                                  },
-                                ),
-                              ))),
-                    ],
-                  ),
-                  SizedBox(height: 40),
-                  TextField(
-                    controller: _internalRecord,
-                    decoration: InputDecoration(labelText: 'Internal Record'),
-                    maxLines: 8, // 允许多行输入
-                    keyboardType: TextInputType.multiline,
-                    onChanged: (String? newValue) {
-                      // 在这里处理下拉框选项更改事件
-                      setState(() {
-                        detail.internalRecord = newValue;
-                      });
-                    },
-                  ),
-                  SizedBox(height: 40),
-                  Container(
-                    height: 500,
-                    child: GridView.builder(
-                        itemCount: deviceTypes.length,
-                        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
-                          crossAxisCount: 3, // 设置为两列
-                          crossAxisSpacing: 10,
-                          mainAxisSpacing: 2,
-                          childAspectRatio: 1.4,
-                        ),
-                        itemBuilder: (BuildContext context, int i) {
-                          return Column(
-                            children: [
-                              Text(deviceTypes[i]),
-                              SizedBox(height: 8),
-                              Container(
-                                height: 280,
-                                child: DefaultTabController(
-                                  length: languages.length,
-                                  child: Scaffold(
-                                    appBar: PreferredSize(
-                                        preferredSize: Size.fromHeight(
-                                            48.0), // here the desired height
-                                        child: AppBar(
-                                          automaticallyImplyLeading: false,
-                                          bottom: TabBar(
-                                            tabs: [
-                                              for (int j = 0;
-                                                  j < languages.length;
-                                                  j++)
-                                                Tab(text: languages[j]),
-                                            ],
-                                          ),
-                                        )),
-                                    body: TabBarView(
-                                      children: [
-                                        for (int j = 0;
-                                            j < languages.length;
-                                            j++)
-                                          Padding(
-                                            padding: EdgeInsets.zero,
-                                            child: TextField(
-                                              controller: _controllers[
-                                                  i * languages.length + j],
+                            ),
+                          ]),
+                      SizedBox(height: 40),
+                      Container(
+                        height: 500,
+                        child: GridView.builder(
+                            itemCount: deviceTypes.length,
+                            gridDelegate:
+                                SliverGridDelegateWithFixedCrossAxisCount(
+                              crossAxisCount: 3, // 设置为两列
+                              crossAxisSpacing: 10,
+                              mainAxisSpacing: 2,
+                              childAspectRatio: 1.4,
+                            ),
+                            itemBuilder: (BuildContext context, int i) {
+                              return Column(
+                                children: [
+                                  Text(deviceTypes[i]),
+                                  SizedBox(height: 8),
+                                  Container(
+                                    height: 280,
+                                    child: DefaultTabController(
+                                      length: languages.length,
+                                      child: Scaffold(
+                                        appBar: PreferredSize(
+                                            preferredSize: Size.fromHeight(
+                                                48.0), // here the desired height
+                                            child: AppBar(
+                                              automaticallyImplyLeading: false,
+                                              bottom: TabBar(
+                                                tabs: [
+                                                  for (int j = 0;
+                                                      j < languages.length;
+                                                      j++)
+                                                    Tab(text: languages[j]),
+                                                ],
+                                              ),
+                                            )),
+                                        body: TabBarView(
+                                          children: [
+                                            for (int j = 0;
+                                                j < languages.length;
+                                                j++)
+                                              Padding(
+                                                padding: EdgeInsets.zero,
+                                                child: TextField(
+                                                  controller: _controllers[
+                                                      i * languages.length + j],
+                                                  decoration: InputDecoration(
+                                                    border: OutlineInputBorder(
+                                                      borderRadius:
+                                                          BorderRadius.circular(
+                                                              5.0),
+                                                    ),
+                                                  ),
 
-                                              maxLines: 8, // 允许多行输入
-                                              keyboardType:
-                                                  TextInputType.multiline,
-                                              onChanged: (value) => {
-                                                upgradeInfos[
-                                                        i * languages.length +
+                                                  maxLines: 8, // 允许多行输入
+                                                  keyboardType:
+                                                      TextInputType.multiline,
+                                                  onChanged: (value) => {
+                                                    upgradeInfos[i *
+                                                                languages
+                                                                    .length +
                                                             j]
-                                                    .describe = value
-                                              },
-                                            ),
-                                          ),
-                                      ],
+                                                        .describe = value
+                                                  },
+                                                ),
+                                              ),
+                                          ],
+                                        ),
+                                      ),
                                     ),
                                   ),
-                                ),
-                              ),
-                            ],
-                          );
-                        }),
-                  ),
-                  Row(
-                    mainAxisAlignment: MainAxisAlignment.center,
-                    children: [
-                      // TextButton(
-                      //   child: Text(
-                      //       AppLocalizations.of(context)!.cancel),
-                      //   onPressed: () {
-                      //     Navigator.of(context).pop();
-                      //   },
-                      // ),
-                      // SizedBox(width: 8), // 添加间距
-                      TextButton(
-                        child: Text(AppLocalizations.of(context)!.submit),
-                        onPressed: () {
-                          detail.upgradeInfos = upgradeInfos;
-                          onSavePressed(detail);
-                          Navigator.of(context).pop();
-                        },
+                                ],
+                              );
+                            }),
                       ),
                     ],
                   ),
-                ],
-              ),
-            );
-          }),
-        ));
+                );
+              }),
+            )));
   }
 
-  void onSavePressed(detail) async {
+  void onSavePressed(detail, context) async {
     var service = GetIt.instance.get<PackageService>();
     await service.saveAsync(detail);
+    Navigator.pop(context);
   }
 }