showStackDetails method

void showStackDetails(
  1. BuildContext showContext,
  2. int index
)

Implementation

void showStackDetails(BuildContext showContext, int index) {
  String stack = listViewDataList[index].name;
  var allStr = stack.replaceAll("\\n", "\n");
  showDialog(
      context: showContext,
      builder: (context) {
        return Center(
          child: Container(
            color: Colors.white,
            child: Container(
              color: getLineBgColor(index),
              child: Padding(
                padding: const EdgeInsets.all(30.0),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        GestureDetector(
                          onTap: () {
                            Clipboard.setData(
                              ClipboardData(
                                text: allStr,
                              ),
                            );
                            ScaffoldMessenger.of(showContext).showSnackBar(
                              SnackBar(
                                backgroundColor: Colors.blue,
                                duration: Duration(
                                  seconds: 1,
                                ),
                                content: Text(
                                  "复制成功",
                                  style: TextStyle(
                                    fontSize: 20,
                                    color: Colors.white,
                                  ),
                                ),
                              ),
                            );
                            Navigator.of(context).pop();
                          },
                          child: Container(
                            margin: EdgeInsets.all(16),
                            padding: EdgeInsets.only(
                              left: 20,
                              right: 20,
                              top: 10,
                              bottom: 10,
                            ),
                            color: Colors.blue,
                            child: Text(
                              "复制",
                              style: TextStyle(
                                fontSize: 14,
                                color: Colors.white,
                              ),
                            ),
                          ),
                        ),
                        GestureDetector(
                          onTap: () {
                            Navigator.of(context).pop();
                          },
                          child: Container(
                            margin: EdgeInsets.all(16),
                            padding: EdgeInsets.only(
                              left: 20,
                              right: 20,
                              top: 10,
                              bottom: 10,
                            ),
                            color: Colors.blueGrey,
                            child: Text(
                              "关闭",
                              style: TextStyle(
                                fontSize: 14,
                                color: Colors.white,
                              ),
                            ),
                          ),
                        ),
                      ],
                    ),
                    Container(
                      height: kIsWeb ? null : 300,
                      child: SingleChildScrollView(
                        child: Text(
                          allStr,
                          // maxLines: 10,
                          style: TextStyle(
                            fontSize: 14,
                            color: Colors.black,
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      });
}