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

Skintone overlay position incorrect when using with go_router ShellRoute #148

Closed
crizant opened this issue Aug 4, 2023 · 3 comments · Fixed by #161
Closed

Skintone overlay position incorrect when using with go_router ShellRoute #148

crizant opened this issue Aug 4, 2023 · 3 comments · Fixed by #161

Comments

@crizant
Copy link

crizant commented Aug 4, 2023

Screenshot 2023-08-04 at 11 53 52 AM

Minimal code snippet:

import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

final router = GoRouter(
  routes: [
    ShellRoute(
      builder: (BuildContext context, GoRouterState state, Widget child) {
        return Row(
          children: [
            const SizedBox(
              width: 300.0,
            ),
            Expanded(
              child: child,
            ),
          ],
        );
      },
      routes: [
        GoRoute(
          path: '/',
          builder: (BuildContext context, state) {
            return const MyHomePage();
          },
        ),
      ],
    ),
  ],
);

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) {
    return MaterialApp.router(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      routerConfig: router,
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final _controller = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.end,
          children: [
            TextField(
              controller: _controller,
            ),
            SizedBox(
              height: 300,
              child: EmojiPicker(
                textEditingController: _controller,
                config: const Config(
                  columns: 12,
                  initCategory: Category.SMILEYS,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
@Fintasys
Copy link
Owner

Fintasys commented Oct 7, 2023

@crizant Thanks for the bug report. I can reproduce the issue and it is caused by calculating the position over the overlay from the global coordinates. I tried quickly to fix it, but seems it requires more time. 🙏

Edit: first I assumed it's not because of ShellRoute just because of the space on the left. But seems it's only happening with ShellRoute. Not sure was could cause this 🤔

@Fintasys
Copy link
Owner

Fintasys commented Oct 22, 2023

@crizant I tried to address your issue, but it's not as trivial as I thought. As result I added a new parameter to the Config. Would be great if you could give it a try on your project.

  emoji_picker_flutter:
    git:
      url: https://github.com/Fintasys/emoji_picker_flutter.git
      ref: fix-for-shellRoute-issue

and then Config

config: Config(
   ...
   customSkinColorOverlayHorizontalOffset: 0.0,
   ...
)   

@crizant
Copy link
Author

crizant commented Oct 23, 2023

I ended up creating my own emoji picker, I'm afraid that I will not be able to help test your fix. 😵‍💫

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

Successfully merging a pull request may close this issue.

2 participants