Home > Blockchain >  Show Two Languages at once
Show Two Languages at once

Time:02-08

Fisrt of all i am following enter image description here

Also for time being, I have used easy_localization: 3.0.0 but still the problem is how i support multiple language at once with this package

CodePudding user response:

  1. Don't use localization for this part - drawer widget - text items
  2. wrap drawer widget with Directionality widget to prevent it from mirroring and make text in the same place.
  3. pop the drawer after using switch widget.

Example:

import 'package:flutter/material.dart' as ltr;


drawer: Directionality(
    textDirection: ltr.TextDirection.ltr,
    child: Container(
      color: Colors.lightGreen,
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text('English'),
              Text('عربي'),
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text('English'),
              Text('عربي'),
            ],
          ),
        ],
      ),
    ),
  ),
  •  Tags:  
  • Related