83 lines
2.6 KiB
Dart
83 lines
2.6 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:manager_app/Components/multi_input_modal.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
import 'package:managerapi/api.dart';
|
|
|
|
class MultiStringContainer extends StatelessWidget {
|
|
final Color color;
|
|
final String label;
|
|
final String modalLabel;
|
|
final List<TranslationDTO> initialValue;
|
|
final Function onGetResult;
|
|
final int maxLines;
|
|
final bool isTitle;
|
|
final double fontSize;
|
|
const MultiStringContainer({
|
|
Key key,
|
|
this.color = kSecond,
|
|
this.label,
|
|
this.modalLabel,
|
|
this.initialValue,
|
|
this.onGetResult,
|
|
this.maxLines,
|
|
this.isTitle,
|
|
this.fontSize = 25,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
Size size = MediaQuery.of(context).size;
|
|
return Container(
|
|
child: Row(
|
|
children: [
|
|
Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
child: AutoSizeText(
|
|
label,
|
|
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
|
maxLines: 2,
|
|
maxFontSize: fontSize,
|
|
textAlign: TextAlign.center,
|
|
)
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Container(
|
|
width: size.width *0.15,
|
|
child: InkWell(
|
|
onTap: () {
|
|
List<TranslationDTO> newValues = <TranslationDTO>[];
|
|
// Make a copy
|
|
initialValue.forEach((value) {
|
|
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
|
|
});
|
|
showMultiStringInput(label, modalLabel, isTitle, initialValue, newValues, onGetResult, maxLines, context);
|
|
},
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
borderRadius: BorderRadius.circular(50),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
|
child: Center(
|
|
child: AutoSizeText(
|
|
"Changer les traductions",
|
|
style: TextStyle(color: kWhite),
|
|
maxLines: 2,
|
|
)
|
|
),
|
|
)
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |