Home > Software design >  Keyboard hide textfield when using flutter_screenutil package in flutter?
Keyboard hide textfield when using flutter_screenutil package in flutter?

Time:09-07

I want to see the bottom textfield in chat screen when keyboard is active

my structure:

Column(
        children: [
          ListView.builder(
            itemCount: controller.messages.length,
            itemBuilder: (BuildContext context, int index) {
              final item = controller.messages[index];
              return Message(
                msg: item.message.toString(),
                direction: index % 2 == 0 ? 'left' : 'right',
              );
            },
          ),
          Row(
            children: [
              Icon(Icons.add),
              TextInput(
                controller: controller.textController,
                hint: 'Write Here',
                border: const OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(35))),
              ),
              IconButton(
                onPressed: () => controller.sendMessage(),
                icon: Icon(Icons.send, color: kPrimaryColor),
              )
            ],
          ),
        ],
      ),

CodePudding user response:

ScreenUtilInit(
  designSize: Size(375, 867),
  minTextAdapt: true,
  rebuildFactor: RebuildFactors.all,
  builder: (BuildContext context, Widget? child) => MaterialApp(
    debugShowCheckedModeBanner: false,
    title: 'title',
  ),
);

CodePudding user response:

if you are using latest version of ScreenUtilInit then make sure ScreenUtilInit is parent of your MaterialApp

ScreenUtilInit(
  designSize: Size(yourWidth, yourHeight),
  builder: (BuildContext context, Widget? child){
    return MaterialApp() 
  },
);
  • Related