rename widgets and remove unnecessary code

This commit is contained in:
ashilkn 2024-02-23 15:52:37 +05:30
parent be11b398d3
commit 30b914cc5c
3 changed files with 10 additions and 16 deletions

View file

@ -5,19 +5,12 @@ import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/map/enable_map.dart";
import "package:photos/ui/map/map_screen.dart";
class GoToMapWidget extends StatelessWidget {
const GoToMapWidget({super.key});
//Used for empty state of location section
class GoToMap extends StatelessWidget {
const GoToMap({super.key});
@override
Widget build(BuildContext context) {
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
late final double width;
if (textScaleFactor <= 1.0) {
width = 85.0;
} else {
width = 85.0 + ((textScaleFactor - 1.0) * 64);
}
return GestureDetector(
onTap: () async {
final bool result = await requestForMapEnable(context);

View file

@ -149,7 +149,7 @@ class _SearchSectionState extends State<SearchSection> {
widget.sectionType == SectionType.location
? const Padding(
padding: EdgeInsets.fromLTRB(8, 24, 8, 0),
child: GoToMapWidget(),
child: GoToMap(),
)
: const SizedBox.shrink(),
],
@ -170,7 +170,7 @@ class SearchExampleRow extends StatelessWidget {
//Cannot use listView.builder here
final scrollableExamples = <Widget>[];
if (sectionType == SectionType.location) {
scrollableExamples.add(const GoToMapWidget());
scrollableExamples.add(const GoToMap());
}
examples.forEachIndexed((index, element) {
scrollableExamples.add(

View file

@ -97,13 +97,13 @@ class _LocationsSectionState extends State<LocationsSection> {
),
const SizedBox(width: 8),
const SearchSectionEmptyCTAIcon(SectionType.location),
const GoToMapWidget(),
const GoToMap(),
],
),
);
} else {
final recommendations = <Widget>[
const GoToMap2(),
const GoToMapWithBG(),
..._locationsSearchResults.map(
(locationSearchResult) =>
LocationRecommendation(locationSearchResult),
@ -361,8 +361,9 @@ class LocationRecommendation extends StatelessWidget {
}
}
class GoToMap2 extends StatelessWidget {
const GoToMap2({super.key});
//Used for non-empty state of location section.
class GoToMapWithBG extends StatelessWidget {
const GoToMapWithBG({super.key});
@override
Widget build(BuildContext context) {