dart flutter code to be used below
import 'package:flutter/material.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:fluent_ui/fluent_ui.dart' as fluent; // Aliased import
import 'dart:io';
import 'package:path/path.dart' as p;

void main() {
  runApp(const MyApp());
  doWhenWindowReady(() {
    final win = appWindow;
    const initialSize = Size(1190, 750);
    win.minSize = initialSize;
    win.size = initialSize;
    win.maxSize = initialSize;
    win.alignment = Alignment.center;
    win.title = "Custom window with Flutter";
    win.show();
  });
}

const borderColor = fluent.Color(0xFF805306);

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return fluent.FluentApp(
      title: 'Fluent UI Demo',
      theme: fluent.FluentThemeData(
        accentColor: fluent.Colors.blue,
      ),
      home: Scaffold(
        body: WindowBorder(
          color: borderColor,
          width: 1,
          child: const RightSide(), // RightSide widget handles language options
        ),
      ),
    );
  }
}

class RightSide extends StatefulWidget {
  const RightSide({super.key});

  @override
  _RightSideState createState() => _RightSideState();
}

class _RightSideState extends State<RightSide> {
  List<String> langOptions = [];
  String? selectedLanguage;

  @override
  void initState() {
    super.initState();
    fetchLangOptions(); // Fetch language options on startup
  }

  Future<void> fetchLangOptions() async {
    final directory = Directory('assets/lang'); // Directory path

    try {
      final files = directory.listSync();
      List<String> options = [];
      for (var file in files) {
        if (file is File) {
          String fileName = p.basenameWithoutExtension(file.path); // Get the file name without the extension
          if (fileName.length >= 2) {
            options.add(fileName.substring(0, 2)); // Get the first 2 characters
          }
        }
      }
      setState(() {
        langOptions = options; // Update the state with fetched options
      });
      await setInitialSelectedLanguage(); // Set the initial selected language
    } catch (e) {
      print('Error reading directory: $e');
    }
  }

  Future<void> setInitialSelectedLanguage() async {
    final file = File('assets/preferences.txt');

    try {
      if (await file.exists()) {
        String firstLine = (await file.readAsLines()).first.trim();
        // Get the last 2 characters of the first line
        String lastTwoChars = firstLine.length >= 2 ? firstLine.substring(firstLine.length - 2) : firstLine;

        // Check if the value exists in langOptions
        if (langOptions.contains(lastTwoChars)) {
          setState(() {
            selectedLanguage = lastTwoChars; // Update the selected language
          });
        }
      }
    } catch (e) {
      print('Error reading preferences file: $e');
    }
  }

  Future<void> updatePreferencesFile(String value) async {
    final file = File('assets/preferences.txt');

    try {
      if (await file.exists()) {
        // Update the preferences file, writing the last 2 characters of the selected value
        await file.writeAsString(value, mode: FileMode.write);
      }
    } catch (e) {
      print('Error writing to preferences file: $e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        // Window Title Bar with MoveWindow
        WindowTitleBarBox(
          child: Row(
            children: [
              Expanded(child: MoveWindow()),
              const WindowButtons(), // Window control buttons
            ],
          ),
        ),
        // Header Bar below the Window Title Bar
        Container(
          height: 40,
          color: fluent.Colors.black, // Set a color for the header bar to black
          child: Row(
            children: [
              const Expanded(
                child: Center(
                  child: Text(
                    "Text Holder",
                    style: TextStyle(
                      color: fluent.Colors.white, // Set text color
                      fontSize: 16, // Set text size
                      fontWeight: FontWeight.bold, // Set text style
                    ),
                  ),
                ),
              ),
              // Fluent UI ComboBox wrapped in SizedBox to control the width
              Padding(
                padding: const EdgeInsets.only(right: 16.0), // Add right padding
                child: SizedBox(
                  width: 65, // Set the desired width of the ComboBox
                  height: 35,
                  child: fluent.ComboBox<String>(
                    placeholder: const Text('..'),
                    style: const TextStyle(
                      fontSize: 14),
                    value: selectedLanguage,
                    onChanged: (String? newValue) {
                      if (newValue != null) {
                        setState(() {
                          selectedLanguage = newValue; // Update selected language
                        });
                        // Write the last 2 characters of the selected language to preferences file
                        updatePreferencesFile(newValue);
                      }
                    },
                    items: langOptions.map((String value) {
                      return fluent.ComboBoxItem<String>(
                        value: value,
                        child: Text(value),
                      );
                    }).toList(),
                  ),
                ),
              ),
            ],
          ),
        ),
        const SizedBox(height: 10), // Space between the header and button
        // Button placed 100px from the left
        Container(
          alignment: Alignment.centerLeft,
          padding: const EdgeInsets.only(left: 130.0, bottom: 10.0), // 100px space from the left
          child: fluent.Button(
            onPressed: () {
              // Action for the button
              print('Initialize button pressed.');
            }, 
                    child: const Text('Initialize'),// Button text
          ),
        ),
        // Content Area Below the Header Bar
        Expanded(
          child: Container(
            decoration: const BoxDecoration(
              gradient: LinearGradient(
                begin: Alignment.topCenter,
                end: Alignment.bottomCenter,
                colors: [fluent.Colors.white, fluent.Colors.white],
                stops: [0.0, 1.0],
              ),
            ),
            child: const Column(
              children: [
                Expanded(
                  child: Center(
                    child: Text("Content Area"), // Example content
                  ),
                ),
              ],
            ),
          ),
        ),
      ],
    );
  }
}

final buttonColors = WindowButtonColors(
  iconNormal: const fluent.Color(0xFF805306),
  mouseOver: const fluent.Color(0xFFF6A00C),
  mouseDown: const fluent.Color(0xFF805306),
  iconMouseOver: const fluent.Color(0xFF805306),
  iconMouseDown: const fluent.Color(0xFFFFD500),
);

final closeButtonColors = WindowButtonColors(
  mouseOver: const fluent.Color(0xFFD32F2F),
  mouseDown: const fluent.Color(0xFFB71C1C),
  iconNormal: const fluent.Color(0xFF805306),
  iconMouseOver: fluent.Colors.white,
);

class WindowButtons extends StatelessWidget {
  const WindowButtons({super.key});

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        MinimizeWindowButton(colors: buttonColors),
        // MaximizeWindowButton(colors: buttonColors),
        CloseWindowButton(colors: closeButtonColors),
      ],
    );
  }
}
amend so that pressing the Initialize button iterates through the open com serial ports, send out this command wei.zrp followed by a CR and LF. Serial connection is Baud:57600, Data Bits:8, Stop Bits:1, Parity:None. Output the response.