allow two column mode from settings

This commit is contained in:
erinn 2021-05-13 12:58:16 -07:00
parent 8a6d35967f
commit 46e48fbdc5
2 changed files with 27 additions and 1 deletions

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../main.dart';
import '../model.dart';
import 'contactsview.dart';
import 'messageview.dart';
@ -26,7 +27,12 @@ class _DoubleColumnViewState extends State<DoubleColumnView> {
child: flwtch.selectedConversation == ""
? Center(child: Text("pick a contact"))
: //dev
Container(child: MessageView()),
MultiProvider(
providers: [
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context).contactList.getContact(flwtch.selectedConversation)),
],
child: Container(child: MessageView())),
),
],
);

View File

@ -74,6 +74,26 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
},
secondary: Icon(Icons.lightbulb_outline, color: settings.current().mainTextColor()),
),
ListTile(
title: Text(/*AppLocalizations.of(context).settingLanguage*/"UI Columns", style: TextStyle(color: settings.current().mainTextColor())),
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor()),
trailing: DropdownButton(
value: Provider.of<Settings>(context).locale.languageCode,
onChanged: (String newValue) {
if (newValue == "Double (1:2)") {
Provider.of<FlwtchState>(context).columns = [1, 2];
} else if (newValue == "Double (1:4)") {
Provider.of<FlwtchState>(context).columns = [1, 4];
} else {
Provider.of<FlwtchState>(context).columns = [1];
}
},
items: ["Single", "Double (1:2)", "Double (1:4)"].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList())),
SwitchListTile(
title: Text(AppLocalizations.of(context).blockUnknownLabel, style: TextStyle(color: settings.current().mainTextColor())),
subtitle: Text(AppLocalizations.of(context).descriptionBlockUnknownConnections),