test
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:oc_front/core/models/shared_workspace_local.dart';
|
||||
import 'package:oc_front/core/services/specialized_services/shared_service.dart';
|
||||
import 'package:oc_front/core/services/specialized_services/workspace_service.dart';
|
||||
import 'package:oc_front/models/response.dart';
|
||||
import 'package:oc_front/main.dart';
|
||||
import 'package:oc_front/models/search.dart';
|
||||
import 'package:oc_front/pages/catalog.dart';
|
||||
import 'package:oc_front/core/models/workspace_local.dart';
|
||||
import 'package:oc_front/pages/shared.dart';
|
||||
import 'package:oc_front/widgets/inputs/shallow_text_input.dart';
|
||||
import 'package:oc_front/widgets/items/item_row.dart';
|
||||
import 'package:oc_front/widgets/inputs/shallow_dropdown_input.dart';
|
||||
import 'package:oc_front/core/services/specialized_services/workspace_service.dart';
|
||||
|
||||
GlobalKey<EndDrawerWidgetState> endDrawerKey = GlobalKey<EndDrawerWidgetState>();
|
||||
class EndDrawerWidget extends StatefulWidget {
|
||||
@@ -24,12 +23,12 @@ class EndDrawerWidgetState extends State<EndDrawerWidget> {
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: 400,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
height: getHeight(context),
|
||||
child: Column( children: [
|
||||
Container(
|
||||
width: 400,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(color: Color.fromRGBO(38, 166, 154, 1)),
|
||||
decoration: BoxDecoration(color: lightColor ),
|
||||
child: const Center(
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@@ -41,53 +40,61 @@ class EndDrawerWidgetState extends State<EndDrawerWidget> {
|
||||
),
|
||||
ShallowDropdownInputWidget(
|
||||
current: WorkspaceLocal.current,
|
||||
filled: Colors.grey.shade200,
|
||||
filled: Colors.white,
|
||||
width: 400,
|
||||
all: () async => WorkspaceLocal.getWorkspacesShallow(),
|
||||
canRemove: (p0) => p0 != null,
|
||||
remove: (p0) async {
|
||||
await WorkspaceService().delete(context, p0, {}).then( (e) => WorkspaceLocal.deleteWorkspace(p0));
|
||||
},
|
||||
type: SharedWorkspaceType.workspace,
|
||||
type: CollaborativeAreaType.workspace,
|
||||
change: (String? change) {
|
||||
WorkspaceLocal.changeWorkspace(change.toString());
|
||||
}
|
||||
),
|
||||
Container(
|
||||
width: 400,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border(bottom: BorderSide(color: midColor), top: BorderSide(color: midColor)),
|
||||
),
|
||||
child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Padding(padding: EdgeInsets.only(right: 5), child: Icon(Icons.share, size: 12, color: Colors.grey)),
|
||||
Text( (WorkspaceLocal.workspaces[WorkspaceLocal.current]?.shared) == null ?
|
||||
"actually not shared" : "share with ${WorkspaceLocal.workspaces[WorkspaceLocal.current]!.shared!}",
|
||||
style: TextStyle( fontSize: 14, color: Colors.grey ),),
|
||||
]),
|
||||
),
|
||||
Column( children: [
|
||||
itemRows.isEmpty ? Container( height: MediaQuery.of(context).size.height - 100,
|
||||
color: Colors.grey.shade300,
|
||||
child: const Center(child: Text("WORKSPACE IS EMPTY",
|
||||
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: Colors.white))))
|
||||
: Container( height: MediaQuery.of(context).size.height - 100, child: SingleChildScrollView(
|
||||
itemRows.isEmpty ? Container( height: getHeight(context) - 140,
|
||||
color: Colors.white,
|
||||
child: Center(child: Text("WORKSPACE IS EMPTY",
|
||||
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w600, color: midColor))))
|
||||
: Container( height: getHeight(context) - 140, child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column( children: [ ...itemRows, Container(height: 50)])
|
||||
)),
|
||||
])
|
||||
])
|
||||
),
|
||||
itemRows.isEmpty ? Container() : Positioned( bottom: 0, left: 0,
|
||||
child: ShallowDropdownInputWidget(
|
||||
type: SharedWorkspaceType.workspace,
|
||||
all: () async => SharedWorkspaceLocal.workspaces.values.map(
|
||||
(e) => Shallow(id: e.id ?? "", name: e.name ?? "") ).toList(),
|
||||
current: WorkspaceLocal.workspaces[WorkspaceLocal.current]?.shared,
|
||||
width: 400,
|
||||
filled: Colors.grey.shade300,
|
||||
hintColor: Colors.grey,
|
||||
color: Colors.black,
|
||||
canLoad: (String? change) => SharedWorkspaceLocal.workspaces[change] == null
|
||||
|| !SharedWorkspaceLocal.workspaces[change]!.workspaces.map( (e) => e.id ).contains(WorkspaceLocal.current),
|
||||
canRemove: (String? change) => SharedWorkspaceLocal.workspaces[change] == null
|
||||
|| SharedWorkspaceLocal.workspaces[change]!.workspaces.map( (e) => e.id ).contains(WorkspaceLocal.current),
|
||||
load: (String val) async {
|
||||
await SharedService().addWorkspace(context, val, WorkspaceLocal.current ?? "");
|
||||
SharedWorkspaceLocal.init(context, false);
|
||||
},
|
||||
remove: (String val) async {
|
||||
await SharedService().removeWorkspace(context, val, WorkspaceLocal.current ?? "");
|
||||
SharedWorkspaceLocal.init(context, false);
|
||||
})
|
||||
)
|
||||
Positioned( bottom: 0, left: 0,
|
||||
child: Tooltip( message: "create workspace", child: ShallowTextInputWidget(
|
||||
width: 400,
|
||||
tooltipLoad: "create workspace",
|
||||
iconLoad: Icons.create_new_folder_sharp,
|
||||
type: CollaborativeAreaType.workspace,
|
||||
color: Colors.white,
|
||||
filled: midColor,
|
||||
hint: "enter workspace name",
|
||||
hintColor: Colors.grey,
|
||||
canLoad: (String? remove) => remove != null,
|
||||
load: (Map<String?, dynamic> add) async {
|
||||
if (add["name"] == null) { return; }
|
||||
WorkspaceLocal.createWorkspace(add["name"], context);
|
||||
},
|
||||
),
|
||||
))
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user