Dn-a / flutter_inner_drawer

Inner Drawer is an easy way to create an internal side section (left/right) where you can insert a list-menu or other.
https://pub.dartlang.org/packages/flutter_inner_drawer
MIT License
516 stars 130 forks source link

Doesn't work with RTL locale #55

Open paurakhsharma opened 3 years ago

paurakhsharma commented 3 years ago

It doesn't work (leftChild, rightChild slide doesn't work) when I use a RTL locale.

import 'package:flutter/material.dart';
import 'package:flutter_inner_drawer/inner_drawer.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      supportedLocales: [
        Locale('ar'),
        Locale('en', 'GB')
      ],
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      locale: Locale('ar'),
      home: HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  //  Current State of InnerDrawerState
  final GlobalKey<InnerDrawerState> _innerDrawerKey =
      GlobalKey<InnerDrawerState>();

  @override
  Widget build(BuildContext context) {
    return InnerDrawer(
        key: _innerDrawerKey,
        onTapClose: true,
        swipe: true,
        swipeChild: true,
        offset: IDOffset.only(
          right: 0.60,
          left: 0.60,
        ),
        leftAnimationType: InnerDrawerAnimation.static,
        rightAnimationType: InnerDrawerAnimation.quadratic,
        backgroundDecoration: BoxDecoration(
          color: Colors.white,
        ),
        leftChild: Container(
          color: Colors.red,
        ),
        rightChild: Container(
          padding: const EdgeInsets.all(8.0),
          color: Colors.green,
        ),
        scaffold: Scaffold(
          body: Container(
            constraints: BoxConstraints.expand(),
            color: Colors.teal,
            child: Center(child: Text('center')),
          ),
        ),
      );
  }
}

If I change locale: Locale('ar'), to locale: Locale('en', 'GB'), it works just fine.

Any idea how I can get child sliders to work with RTL language?