editorView method

Widget editorView(
  1. BuildContext context,
  2. FileIDE file
)

Implementation

Widget editorView(BuildContext context, FileIDE file) {
  return ListView(
    padding: const EdgeInsets.only(top: 0),
    physics: const ClampingScrollPhysics(),
    scrollDirection: Axis.horizontal,
    controller: horizontalController,
    children: [
      SizedBox(
        height: 1000,
        width: 2500,
        child: ListView(
          padding: widget.options.hasRegion
              ? const EdgeInsets.only(top: 10)
              : const EdgeInsets.only(top: 0),
          physics: const ClampingScrollPhysics(),
          controller: scrollController,
          scrollDirection: Axis.vertical,
          shrinkWrap: true,
          children: [
            if (file.hasRegion && beforeController.text.isNotEmpty)
              TextField(
                smartQuotesType: SmartQuotesType.disabled,
                smartDashesType: SmartDashesType.disabled,
                controller: beforeController,
                decoration: InputDecoration(
                  border: InputBorder.none,
                  fillColor: widget.options.editorBackgroundColor,
                  filled: true,
                  isDense: true,
                  contentPadding: const EdgeInsets.only(
                    left: 10,
                  ),
                ),
                maxLines: null,
                style: TextStyle(
                  fontSize: getFontSize(context, fontSize: 18),
                  fontFamily: widget.options.fontFamily,
                  color: Colors.white.withValues(
                    alpha: 0.87,
                  ),
                ),
                onChanged: (String event) {
                  handleTextChange(
                    event,
                    RegionPosition.before,
                    file.hasRegion,
                  );
                  if (file.hasRegion) {
                    handleRegionCaching(file, event, RegionPosition.before);
                  }
                },
                onTap: () {
                  handleCurrentFocusedTextfieldController(
                    RegionPosition.before,
                  );
                },
                inputFormatters: [
                  FilteringTextInputFormatter.deny(RegExp(r'[“”]'),
                      replacementString: '"'),
                  FilteringTextInputFormatter.deny(RegExp(r'[‘’]'),
                      replacementString: "'")
                ],
              ),
            TextField(
              smartQuotesType: SmartQuotesType.disabled,
              smartDashesType: SmartDashesType.disabled,
              controller: inController,
              decoration: InputDecoration(
                border: InputBorder.none,
                fillColor: file.hasRegion
                    ? file.region.color
                    : widget.options.editorBackgroundColor,
                filled: true,
                isDense: true,
                contentPadding: EdgeInsets.only(
                  left: 10,
                  top: file.hasRegion ? 0 : 10,
                ),
              ),
              onChanged: (String event) {
                handleTextChange(event, RegionPosition.inner, file.hasRegion);
                if (file.hasRegion) {
                  handleRegionCaching(file, event, RegionPosition.inner);
                }
              },
              onTap: () {
                handleCurrentFocusedTextfieldController(RegionPosition.inner);
              },
              inputFormatters: [
                FilteringTextInputFormatter.deny(RegExp(r'[“”]'),
                    replacementString: '"'),
                FilteringTextInputFormatter.deny(RegExp(r'[‘’]'),
                    replacementString: "'")
              ],
              maxLines: null,
              style: TextStyle(
                fontSize: getFontSize(context, fontSize: 18),
                fontFamily: widget.options.fontFamily,
                color: Colors.white.withValues(
                  alpha: 0.87,
                ),
              ),
            ),
            if (file.hasRegion && afterController.text.isNotEmpty)
              TextField(
                smartQuotesType: SmartQuotesType.disabled,
                smartDashesType: SmartDashesType.disabled,
                controller: afterController,
                decoration: InputDecoration(
                  border: InputBorder.none,
                  filled: true,
                  fillColor: widget.options.editorBackgroundColor,
                  contentPadding: const EdgeInsets.only(
                    left: 10,
                  ),
                  isDense: true,
                ),
                maxLines: null,
                style: TextStyle(
                  fontSize: getFontSize(context, fontSize: 18),
                  fontFamily: widget.options.fontFamily,
                  color: Colors.white.withValues(alpha: 0.87),
                ),
                onChanged: (String event) {
                  handleTextChange(
                    event,
                    RegionPosition.after,
                    file.hasRegion,
                  );
                },
                onTap: () {
                  handleCurrentFocusedTextfieldController(
                    RegionPosition.after,
                  );
                },
                inputFormatters: [
                  FilteringTextInputFormatter.deny(RegExp(r'[“”]'),
                      replacementString: '"'),
                  FilteringTextInputFormatter.deny(RegExp(r'[‘’]'),
                      replacementString: "'")
                ],
              ),
          ],
        ),
      )
    ],
  );
}