Files
oc-front/lib/core/sections/header/default.dart
2024-11-08 13:59:22 +01:00

49 lines
2.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:oc_front/core/sections/header/header.dart';
import 'package:oc_front/core/services/perms_service.dart';
import 'package:oc_front/core/services/router.dart';
import 'package:oc_front/main.dart';
import 'package:oc_front/pages/shared.dart';
import 'package:oc_front/widgets/inputs/shallow_text_input.dart';
class DefaultWidget extends StatefulWidget{
const DefaultWidget (): super(key: null);
@override DefaultWidgetState createState() => DefaultWidgetState();
}
class DefaultWidgetState extends State<DefaultWidget> {
@override Widget build(BuildContext context) {
return Container(
width: getMainWidth(context),
height: getHeight(context) - 50,
color: midColor,
padding: EdgeInsets.only(top: 50),
child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: getMainHeight(context) < 600 ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [ getMainHeight(context) < 600 ? Container() : Container(
margin: EdgeInsets.only(left: 40),
child: SvgPicture.asset("assets/images/logo.svg", width: 300, height: (getMainHeight(context) / (1.8) ), semanticsLabel: 'OpenCloud Logo')
),
ShallowTextInputWidget(
alignment: MainAxisAlignment.center,
width: getMainWidth(context) / 1.5,
type: CollaborativeAreaType.workspace,
hint: "search in resources...",
iconLoad: PermsService.getPerm(Perms.SEARCH_INTERNAL) ? Icons.search : null,
iconRemove: PermsService.getPerm(Perms.SEARCH_EXTERNAL) ? Icons.screen_search_desktop_outlined : null,
tooltipLoad: PermsService.getPerm(Perms.SEARCH_INTERNAL) ? "search" : null,
tooltipRemove: PermsService.getPerm(Perms.SEARCH_EXTERNAL) ? "distributed search" : null,
canLoad: PermsService.getPerm(Perms.SEARCH_INTERNAL) ? (String? str) => str != null && str.isNotEmpty : null,
canRemove: PermsService.getPerm(Perms.SEARCH_EXTERNAL) ? (String? str) => str != null && str.isNotEmpty : null,
change: (value) => SearchConstants.set(value),
loadStr: PermsService.getPerm(Perms.SEARCH_INTERNAL) ? (String val) async {
AppRouter.currentRoute.factory.search(context, false);
} : null,
remove: PermsService.getPerm(Perms.SEARCH_EXTERNAL) ? (String val) async {
AppRouter.currentRoute.factory.search(context, true);
} : null,
)
])
);
}
}