Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS widgets margin in bottom #1

Closed
poovarasanvasudevan opened this issue Aug 4, 2019 · 2 comments
Closed

IOS widgets margin in bottom #1

poovarasanvasudevan opened this issue Aug 4, 2019 · 2 comments

Comments

@poovarasanvasudevan
Copy link

i am using this for ios cuppertino widgets
all working fine but there is little margin at the bottom

image

Code :

class UserMessagePageState extends State<UserMessagePage> {
  final ChatUser user = ChatUser(
    name: "Poovarasan",
    uid: "123456789",
    avatar: "https://avatars1.githubusercontent.com/u/8036283?s=460&v=4",
  );
  final ChatUser otherUser = ChatUser(
    name: "Poovarasanv",
    uid: "123456780",
    avatar: "https://avatars1.githubusercontent.com/u/8036283?s=460&v=4",
  );

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: CupertinoNavigationBar(
        middle: Text("Message"),
      ),

      body: Container(
        decoration: BoxDecoration(
          color: Colors.green,
        ),
        child: SafeArea(
          child: Material(
            child: Padding(
              padding: const EdgeInsets.only(bottom: 0.0),
              child: DashChat(
                onSend: (ChatMessage message) {},
                messages: [
                  ChatMessage(text: "Hello", user: user, id: "hello"),
                  
                ],
                user: user,
                dateFormat: DateFormat('yyyy-MMM-dd'),
                timeFormat: DateFormat('HH:mm'),
                alwaysShowSend: false,
                messageContainerPadding: EdgeInsets.zero,
                inputContainerStyle: BoxDecoration(
                  border: Border.all(
                      width: 1.0, color: CupertinoColors.lightBackgroundGray),
                  color: Colors.white,
                ),
                shouldShowLoadEarlier: true,
                showTraillingBeforeSend: true,
                trailing: <Widget>[
                  IconButton(
                    icon: Icon(Feather.camera),
                    onPressed: () {
                      print("object");
                    },
                  )
                ],
                sendButtonBuilder: (Function click) {
                  return IconButton(
                    icon: Icon(Feather.send),
                    onPressed: click,
                  );
                },
                leading: <Widget>[
                  IconButton(
                    icon: Icon(Feather.paperclip),
                    onPressed: () {
                      print("object");
                    },
                  )
                ],
                inputDecoration: InputDecoration.collapsed(
                  hintText: "Add message here...",
                ),


//              inputFooterBuilder: () {
//                return Text("Hello");
//              }
              ),
            ),
          ),
        ),
      ),
      //resizeToAvoidBottomPadding: true,
    );
  }
}

@fayeed
Copy link
Owner

fayeed commented Aug 5, 2019

@poovarasanvasudevan The reason you are getting the problem is I have hardcoded a height value if no height is supplied, which is based after android i.e screen height - 80.0 which results in a weird space below the input toolbar because of the CupertinoNavigationBar height is less, I forgot to change the code so I will update it later, in the meantime you could do something like this.

Define your app bar above build method like so, we will use it get the app bars height:

  var appbar = CupertinoNavigationBar(
    middle: Text("Message"),
  );

And in DashChat widget add this:

DashChat(
  height: MediaQuery.of(context).size.height -
            (appbar.preferredSize.height +
                MediaQuery.of(context).viewPadding.top),
);

@fayeed
Copy link
Owner

fayeed commented Aug 8, 2019

@poovarasanvasudevan I going to close this issue now if you have some other problem feel free to create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants