mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 17:48:40 +00:00
fix #57
This commit is contained in:
parent
241662a9d3
commit
9ec9b7a772
3 changed files with 69 additions and 31 deletions
|
|
@ -38,9 +38,11 @@ class FilterSceleton extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FilterText extends StatelessWidget {
|
class FilterText extends StatelessWidget {
|
||||||
const FilterText(this.text, {super.key, this.fontSize = 24});
|
const FilterText(this.text,
|
||||||
|
{super.key, this.fontSize = 24, this.color = Colors.white});
|
||||||
final String text;
|
final String text;
|
||||||
final double fontSize;
|
final double fontSize;
|
||||||
|
final Color color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -49,7 +51,7 @@ class FilterText extends StatelessWidget {
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: fontSize,
|
fontSize: fontSize,
|
||||||
color: Colors.white,
|
color: color,
|
||||||
shadows: [
|
shadows: [
|
||||||
Shadow(
|
Shadow(
|
||||||
color: const Color.fromARGB(122, 0, 0, 0),
|
color: const Color.fromARGB(122, 0, 0, 0),
|
||||||
|
|
@ -62,20 +64,51 @@ class FilterText extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FilterLayerState extends State<FilterLayer> {
|
class _FilterLayerState extends State<FilterLayer> {
|
||||||
|
final PageController pageController = PageController();
|
||||||
|
final List<Widget> pages = [
|
||||||
|
FilterSceleton(),
|
||||||
|
DateTimeFilter(),
|
||||||
|
LocationFilter(),
|
||||||
|
ImageFilter(imagePath: "random/lol.png"),
|
||||||
|
ImageFilter(imagePath: "random/hide_the_pain.png"),
|
||||||
|
ImageFilter(imagePath: "random/yolo.png"),
|
||||||
|
ImageFilter(imagePath: "random/chillen.png"),
|
||||||
|
ImageFilter(imagePath: "random/avocardio.png"),
|
||||||
|
ImageFilter(imagePath: "random/duck.png"),
|
||||||
|
FilterSceleton(),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
pageController.jumpToPage(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return PageView(
|
return PageView.builder(
|
||||||
children: [
|
controller: pageController,
|
||||||
FilterSceleton(),
|
itemCount: pages.length + 2, // Add two for the duplicated pages
|
||||||
DateTimeFilter(),
|
itemBuilder: (context, index) {
|
||||||
LocationFilter(),
|
if (index == 0) {
|
||||||
ImageFilter(imagePath: "random/lol.png"),
|
return pages.last; // Show the last page
|
||||||
ImageFilter(imagePath: "random/hide_the_pain.png"),
|
} else if (index == pages.length + 1) {
|
||||||
ImageFilter(imagePath: "random/yolo.png"),
|
return pages.first; // Show the first page
|
||||||
ImageFilter(imagePath: "random/chillen.png"),
|
} else {
|
||||||
ImageFilter(imagePath: "random/avocardio.png"),
|
return pages[index - 1]; // Show the actual pages
|
||||||
ImageFilter(imagePath: "random/duck.png"),
|
}
|
||||||
],
|
},
|
||||||
|
onPageChanged: (index) {
|
||||||
|
if (index == 0) {
|
||||||
|
// If the user swipes to the first duplicated page, jump to the last page
|
||||||
|
pageController.jumpToPage(pages.length);
|
||||||
|
} else if (index == pages.length + 1) {
|
||||||
|
// If the user swipes to the last duplicated page, jump to the first page
|
||||||
|
pageController.jumpToPage(1);
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ import 'package:intl/intl.dart';
|
||||||
import 'package:twonly/src/components/image_editor/layers/filter_layer.dart';
|
import 'package:twonly/src/components/image_editor/layers/filter_layer.dart';
|
||||||
|
|
||||||
class DateTimeFilter extends StatelessWidget {
|
class DateTimeFilter extends StatelessWidget {
|
||||||
const DateTimeFilter({super.key});
|
const DateTimeFilter({super.key, this.color = Colors.white});
|
||||||
|
|
||||||
|
final Color color;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -16,8 +18,8 @@ class DateTimeFilter extends StatelessWidget {
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
FilterText(currentTime),
|
FilterText(currentTime, color: color),
|
||||||
FilterText(currentDate),
|
FilterText(currentDate, color: color),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:twonly/globals.dart';
|
import 'package:twonly/globals.dart';
|
||||||
import 'package:twonly/src/components/image_editor/layers/filter_layer.dart';
|
import 'package:twonly/src/components/image_editor/layers/filter_layer.dart';
|
||||||
|
import 'package:twonly/src/components/image_editor/layers/filters/datetime_filter.dart';
|
||||||
import 'package:twonly/src/components/image_editor/layers/filters/image_filter.dart';
|
import 'package:twonly/src/components/image_editor/layers/filters/image_filter.dart';
|
||||||
import 'package:twonly/src/proto/api/server_to_client.pb.dart';
|
import 'package:twonly/src/proto/api/server_to_client.pb.dart';
|
||||||
|
|
||||||
|
|
@ -66,22 +67,24 @@ class _LocationFilterState extends State<LocationFilter> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
return FilterSceleton(
|
if (location!.county != "-") {
|
||||||
child: Positioned(
|
return FilterSceleton(
|
||||||
bottom: 50,
|
child: Positioned(
|
||||||
left: 40,
|
bottom: 50,
|
||||||
child: Column(
|
left: 40,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
FilterText(location!.city),
|
children: [
|
||||||
FilterText(location!.region),
|
FilterText(location!.city),
|
||||||
FilterText(location!.county),
|
FilterText(location!.region),
|
||||||
],
|
FilterText(location!.county),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Container();
|
return DateTimeFilter(color: Colors.black);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue