Home > database >  how to add a Container inside this code??? Flutter/Dart
how to add a Container inside this code??? Flutter/Dart

Time:08-19

I have this return on my Widget build and i want to add a Container on top of my screen how can i do that?

return RefreshIndicator(
  onRefresh: refresh,
  child: ListView.separated(
      separatorBuilder: (context, index) => Divider(),
      controller: controller,
      padding: const EdgeInsets.all(8),
      itemCount: evsePanels.length   1,
      itemBuilder: (context, index) {
        if (index < evsePanels.length) {
          return evsePanels[index];
        } else {
          return  Padding(
            padding: const EdgeInsets.symmetric(vertical: 32),
            child: Center(
              child: hasMore
                  ? const CircularProgressIndicator()
                  : const Text('No more data to load'),
            ),
          );
        }
      }
  ),
);

CodePudding user response:

return Column(
      children: [
        RefreshIndicator(
          onRefresh: refresh,
          child: ListView.separated(
          separatorBuilder: (context, index) => Divider(),
    controller: controller,
    padding: const EdgeInsets.all(8),
    itemCount: evsePanels.length   1,
    itemBuilder: (context, index) {
    if (index < evsePanels.length) {
    return evsePanels[index];
    } else {
    return  Padding(
    padding: const EdgeInsets.symmetric(vertical: 32),
    child: Center(
    child: hasMore
    ? const CircularProgressIndicator()
          : const Text('No more data to load'),
    ),
    );
    }
    }
    ),
    ),
        Container(
          color: Colors.red,
          height: MediaQuery.of(context).size.height* 0.1,
          width: MediaQuery.of(context).size.width* 0.1,
          child: Text("Add Widget here"),
        )
      ],
    );

CodePudding user response:

i want to add this code

Container(
            height: widget.appController.queryData.size.height/12,
            width: widget.appController.queryData.size.width * (9/10),
            margin: EdgeInsets.all(5.0),
            decoration: BoxDecoration(
                color: widget.appController.themeController.appWhiteLightColor,
                boxShadow: [
                  BoxShadow(
                    color: widget.appController.themeController.appGreyLightColor.withOpacity(0.6),
                    spreadRadius: 1,
                    blurRadius: 1,
                    offset: Offset(0, 2), // changes position of shadow
                  ),
                ],
                shape: BoxShape.rectangle,
                border: Border.all(
                  color: Colors.transparent,
                ),
                borderRadius: BorderRadius.all(Radius.circular(10))
            ),
            child:Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children:[
                  Container(
                    width: widget.appController.queryData.size.width * (7/10),
                    child: searchTextField,
                  ),
                  Container(
                    child: IconButton(
                      color: widget.appController.themeController.appBlackDeepColor,
                      tooltip: 'Search',
                      icon: const Icon(Icons.search),
                      iconSize: 32 * this.unitHeightValue,
                      onPressed: () {
                        this.evseSearchField = myController.text;
                        showEvsePanels();
                      },
                    ),
                  ),
                ]
            ),
          )
  • Related