lesntecforruixin 1.0.0 copy "lesntecforruixin: ^1.0.0" to clipboard
lesntecforruixin: ^1.0.0 copied to clipboard

The function of this package is for company Lesntec to serve Company Ruixin

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:lesntecforruixin/lesntecforruixin.dart';

void main() {
  runApp(const MyApp());
}

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    const scheme = ColorScheme(
        brightness: Brightness.light,
        error: Colors.red,
        primary: Colors.white,
        onPrimary: berBlue500,
        secondary: berSecondary200,
        onSecondary: Colors.white,
        onError: Colors.red,
        background: berBackground,
        onBackground: berBackground2,
        surface: Colors.grey,
        onSurface: Colors.green);

    const dartScheme = ColorScheme(
        brightness: Brightness.dark,
        error: Colors.red,
        primary: Colors.white,
        onPrimary: Colors.white,
        secondary: berSecondary200,
        onSecondary: berSecondary700,
        onError: Colors.red,
        background: berDarkBackground3,
        onBackground: berDarkBackground3,
        surface: secondBackgroundDark,
        onSurface: berwhite);

    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(colorScheme: scheme),
      darkTheme: ThemeData(colorScheme: dartScheme),
      home: const Homw(),
    );
    // home: const ThreeWebWidget());
  }
}

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

  @override
  State<Homw> createState() => _HomwState();
}

class _HomwState extends State<Homw> {
  String? accessKey;
  String? accessSecret;
  String? uniqueId;
  String? suiteId;
  String? measureMode;
  String? phaseCode;

  @override
  initState() {
    // TODO: implement initState
    super.initState();
    loadData();
  }

  loadData() async {
    String accessKeyTemp = await UnitsDataTool.getValue("accessKey", "");
    String accessSecretTemp = await UnitsDataTool.getValue("accessSecret", "");
    String uniqueIdTemp = await UnitsDataTool.getValue("uniqueId", "");
    String suiteIdTemp = await UnitsDataTool.getValue("suiteId", "");
    String measureModeTemp = await UnitsDataTool.getValue("measureMode", "");
    String phaseCodeTemp = await UnitsDataTool.getValue("phaseCode", "");
    setState(() {
      accessKey = accessKeyTemp;
      accessSecret = accessSecretTemp;
      uniqueId = uniqueIdTemp;
      suiteId = suiteIdTemp;
      measureMode = measureModeTemp;
      phaseCode = phaseCodeTemp;
    });
  }

  @override
  Widget build(BuildContext context) {
    TextEditingController controller1 = TextEditingController();
    controller1.text = accessKey ?? "";
    controller1.addListener(() {});
    TextEditingController controller2 = TextEditingController();
    controller2.text = accessSecret ?? "";
    controller2.addListener(() {});
    TextEditingController controller3 = TextEditingController();
    controller3.text = uniqueId ?? "";
    controller3.addListener(() {});
    TextEditingController controller4 = TextEditingController();
    controller4.text = suiteId ?? "";
    controller4.addListener(() {});
    TextEditingController controller5 = TextEditingController();
    controller5.text = measureMode ?? "";
    controller5.addListener(() {});
    TextEditingController controller6 = TextEditingController();
    controller6.text = phaseCode ?? "";
    controller6.addListener(() {});
    return Scaffold(
        backgroundColor: UnitsForUI.conversionBackgroundColor(context),
        appBar: AppBar(
          title: Text(
            '测试入口',
            maxLines: 2,
            style: TextStyle(
                fontSize: 14,
                color: UnitsForUI.conversionNormalTextColor(context)),
          ),
        ),
        body: SingleChildScrollView(
            scrollDirection: Axis.vertical,
            child: Column(children: [
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('accessKey'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 40,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller1,
                      onChanged: (str) {
                        accessKey = str;
                      },
                      style: const TextStyle(fontSize: 14),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('accessSecret'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 100,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller2,
                      onChanged: (str) {
                        accessSecret = str;
                      },
                      maxLines: 2,
                      style: const TextStyle(fontSize: 14, color: Colors.black),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('measureMode'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 40,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller5,
                      onChanged: (str) {
                        measureMode = str;
                      },
                      style: const TextStyle(fontSize: 14),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('uniqueId'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 40,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller3,
                      onChanged: (str) {
                        uniqueId = str;
                      },
                      style: const TextStyle(fontSize: 14),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('suiteId'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 100,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller4,
                      maxLines: 2,
                      onChanged: (str) {
                        suiteId = str;
                      },
                      style: const TextStyle(fontSize: 14),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20),
                child:
                    Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                  const Text('phaseCode'),
                  Container(
                    margin: const EdgeInsets.only(left: 20),
                    width: 200,
                    height: 40,
                    child: TextField(
                      cursorColor: Colors.black,
                      controller: controller6,
                      onChanged: (str) {
                        phaseCode = str;
                      },
                      style: const TextStyle(fontSize: 14),
                      decoration: const InputDecoration(
                          border: OutlineInputBorder(
                              borderSide: BorderSide(
                                  color: Colors.black,
                                  width: 1,
                                  style: BorderStyle.solid))),
                    ),
                  )
                ]),
              ),
              ElevatedButton(
                style: const ButtonStyle(
                  padding: MaterialStatePropertyAll(
                      EdgeInsets.only(left: 50, right: 50)),
                  backgroundColor: MaterialStatePropertyAll(themeIconColor),
                ),
                child: const Text(
                  '确认',
                  style: TextStyle(color: Colors.white),
                ),
                onPressed: () => _sureClick(),
              ),
            ])));
  }

  void _sureClick() {
    UnitsDataTool.saveString("accessKey", accessKey);
    UnitsDataTool.saveString("accessSecret", accessSecret);
    UnitsDataTool.saveString("uniqueId", uniqueId);
    UnitsDataTool.saveString("suiteId", suiteId);
    UnitsDataTool.saveString("measureMode", measureMode);
    UnitsDataTool.saveString("phaseCode", phaseCode);
    Widget view = Room(
        accessKey: accessKey!,
        accessSecret: accessSecret!,
        uniqueId: uniqueId!,
        suiteId: suiteId!,
        measureMode: measureMode!,
        phaseCode: phaseCode!);
    // Widget view = const Room(
    //     accessKey: "3253165392",
    //     accessSecret: "5241io364cn8xffocllakcwu53qz7r9h",
    //     uniqueId: "1656971040804308417",
    //     suiteId: "RIC05000000000300001000010000200001",
    //     measureMode: "1",
    //     phaseCode: "102");
    MaterialPageRoute route = MaterialPageRoute(builder: (context) => view);
    Navigator.push(context, route);
  }
}