Removed old code

This commit is contained in:
ashilkn 2023-02-03 13:59:28 +05:30
parent 2193546f42
commit c40772c989

View file

@ -1,8 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photos/core/constants.dart';
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/force_reload_home_gallery_event.dart';
import 'package:photos/theme/ente_theme.dart';
import 'package:photos/ui/components/captioned_text_widget.dart';
import 'package:photos/ui/components/icon_button_widget.dart';
@ -22,12 +18,11 @@ class AdvancedSettingsScreen extends StatefulWidget {
}
class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
late int _photoGridSize, _chosenGridSize;
late int _photoGridSize;
@override
void initState() {
_photoGridSize = LocalSettings.instance.getPhotoGridSize();
_chosenGridSize = _photoGridSize;
super.initState();
}
@ -67,7 +62,6 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
children: [
GestureDetector(
onTap: () {
// _showPhotoGridSizePicker(delegateBuildContext);
routeToPage(
context,
const PhotoGridSizePickerPage(),
@ -125,106 +119,4 @@ class _AdvancedSettingsScreenState extends State<AdvancedSettingsScreen> {
),
);
}
Future<void> _showPhotoGridSizePicker(BuildContext buildContext) async {
final textTheme = getEnteTextTheme(buildContext);
final List<Text> options = [];
for (int gridSize = photoGridSizeMin;
gridSize <= photoGridSizeMax;
gridSize++) {
options.add(
Text(
gridSize.toString(),
style: textTheme.body,
),
);
}
return showCupertinoModalPopup(
context: context,
builder: (context) {
return Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Container(
decoration: BoxDecoration(
color: getEnteColorScheme(buildContext).backgroundElevated2,
border: const Border(
bottom: BorderSide(
color: Color(0xff999999),
width: 0.0,
),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
CupertinoButton(
onPressed: () {
Navigator.of(context).pop('cancel');
},
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 5.0,
),
child: Text(
'Cancel',
style: textTheme.body,
),
),
CupertinoButton(
onPressed: () async {
await LocalSettings.instance
.setPhotoGridSize(_chosenGridSize);
Bus.instance.fire(
ForceReloadHomeGalleryEvent("grid size changed"),
);
_photoGridSize = _chosenGridSize;
setState(() {});
Navigator.of(context).pop('');
},
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 2.0,
),
child: Text(
'Confirm',
style: textTheme.body,
),
)
],
),
),
Container(
height: 220.0,
color: const Color(0xfff7f7f7),
child: CupertinoPicker(
backgroundColor:
getEnteColorScheme(buildContext).backgroundElevated,
onSelectedItemChanged: (index) {
_chosenGridSize = _getPhotoGridSizeFromIndex(index);
setState(() {});
},
scrollController: FixedExtentScrollController(
initialItem: _getIndexFromPhotoGridSize(_chosenGridSize),
),
magnification: 1.3,
useMagnifier: true,
itemExtent: 25,
diameterRatio: 1,
children: options,
),
)
],
);
},
);
}
int _getPhotoGridSizeFromIndex(int index) {
return index + 2;
}
int _getIndexFromPhotoGridSize(int gridSize) {
return gridSize - 2;
}
}