-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add carousel to display qrcodes
- Loading branch information
1 parent
9751a7b
commit 2f252f7
Showing
9 changed files
with
121 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class LayoutUtil { | ||
static bool isMobileLayout(BuildContext context) => MediaQuery.of(context).size.width < 600; | ||
static bool isMobileLayout(BuildContext context) => MediaQuery.of(context).size.width < 700; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'dart:math' as math; | ||
|
||
import 'package:carousel_slider/carousel_slider.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_sp_social/presentation/home/home_view/desktop_view.dart'; | ||
|
||
import '../event_store.dart'; | ||
|
||
class CarouselView extends StatefulWidget { | ||
final EventStore store; | ||
|
||
const CarouselView({ | ||
required this.store, | ||
super.key, | ||
}); | ||
|
||
@override | ||
State<CarouselView> createState() => _CarouselViewState(); | ||
} | ||
|
||
class _CarouselViewState extends State<CarouselView> { | ||
final carouselController = CarouselController(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final items = widget.store.value!.socialQrCodes; | ||
final screenHeight = MediaQuery.of(context).size.height; | ||
final screenWidth = MediaQuery.of(context).size.width; | ||
final double maxWidth = math.min(screenWidth * 0.4, 500); | ||
final double maxHeight = math.min(screenHeight * 0.7, maxWidth * 1.2); | ||
|
||
return Container( | ||
alignment: Alignment.center, | ||
width: screenWidth, | ||
child: SizedBox( | ||
height: maxHeight, | ||
child: CarouselSlider( | ||
items: items.map((e) => QRCode(socialQrCode: e, width: maxWidth)).toList(), | ||
carouselController: carouselController, | ||
options: CarouselOptions( | ||
clipBehavior: Clip.none, | ||
autoPlay: true, | ||
viewportFraction: 1, | ||
aspectRatio: screenWidth / screenHeight, | ||
initialPage: 0, | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters