Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

2 display user collection list #6

Merged
merged 2 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions Panoramax.postman_collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"info": {
"_postman_id": "5b7fb4f6-2969-4c31-9ff0-f8d31c9dae97",
"name": "Panoramax",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Get Collections",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "http://localhost:5000/api/collections?",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"api",
"collections"
],
"query": [
{
"key": "",
"value": null
}
]
}
},
"response": []
},
{
"name": "Create Collection",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\r\n \"title\": \"FirstCollection\"\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:5000/api/collections",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"api",
"collections"
]
}
},
"response": []
},
{
"name": "Post picture to Collection",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "isBlurred",
"value": "false",
"type": "default"
},
{
"key": "position",
"value": "1",
"type": "default"
},
{
"key": "picture",
"type": "file",
"src": "/C:/Workspace/Nobelisation/panoramax_mobile/test/pictures/background-beautiful-blossom-calm-waters-268533.jpg"
}
]
},
"url": {
"raw": "http://localhost:5000/api/collections/77d0424b-d87b-47a9-a935-03253cb1c111/items",
"protocol": "http",
"host": [
"localhost"
],
"port": "5000",
"path": [
"api",
"collections",
"77d0424b-d87b-47a9-a935-03253cb1c111",
"items"
]
}
},
"response": []
}
]
}
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ android {
applicationId "com.example.panoramax_mobile"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
111 changes: 111 additions & 0 deletions lib/component/collection_preview.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
part of panoramax;

class CollectionPreview extends StatelessWidget {
final GeoVisioCollection collection;
const CollectionPreview(this.collection, {super.key});

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.all(10),
height: 230,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(18),
),
boxShadow: [
BoxShadow(
color: Colors.grey.shade200,
spreadRadius: 4,
blurRadius: 6,
offset: Offset(0, 3),
),
],
),
child: Column(
children: [
Container(
height: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(18),
topRight: Radius.circular(18),
),
image: DecorationImage(
image: Image.network(collection.getThumbUrl()!).image,
fit: BoxFit.cover,
),
),
child: Stack(
children: [
Positioned(
top: 5,
right: -15,
child: MaterialButton(
color: Colors.white,
shape: CircleBorder(),
onPressed: () {},
child: Icon(
Icons.edit_rounded,
size: 20,
),
),
)
],
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 10, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
collection.title,
style: GoogleFonts.nunito(
fontSize: 18,
fontWeight: FontWeight.w800,
),
),
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${collection.stats_items.count} ${AppLocalizations.of(context)!.element}',
style: GoogleFonts.nunito(
fontSize: 14,
color: Colors.grey[500],
fontWeight: FontWeight.w400,
),
)
],
),
),
Container(
margin: EdgeInsets.fromLTRB(10, 3, 10, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
DATE_FORMATTER.format(DateTime.parse(collection.updated)),
style: GoogleFonts.nunito(
fontSize: 14,
color: Colors.grey[500],
fontWeight: FontWeight.w400,
)
)
],
),
),
],
),
);
}

}
5 changes: 5 additions & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yourCollection": "Your collections",
"element": "element(s)",
"createCollection_tooltip": "Create a new collection"
}
5 changes: 5 additions & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"yourCollection": "Vos Collections",
"element": "element(s)",
"createCollection_tooltip": "Créer une nouvelle collection"
}
112 changes: 25 additions & 87 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
library panoramax;

import 'package:flutter/material.dart';
import '../service/api/api.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:panoramax_mobile/service/api/model/geo_visio.dart';
import 'package:intl/intl.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

part 'component/collection_preview.dart';
part 'page/homepage.dart';


final DateFormat DATE_FORMATTER = DateFormat.yMd();

void main() {
runApp(const MyApp());
Expand Down Expand Up @@ -31,95 +45,19 @@ class MyApp extends StatelessWidget {
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('fr'),
],
home: const HomePage(title: 'Panoramax'),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});

// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.

// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".

final String title;

@override
State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;

void _incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below
// so that the display can reflect the updated values. If we changed
// _counter without calling setState(), then the build method would not be
// called again, and so nothing would appear to happen.
_counter++;
});
}

@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// TRY THIS: Try changing the color here to a specific color (to
// Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
// change color while the other colors stay the same.
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Center(
// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child: Column(
// Column is also a layout widget. It takes a list of children and
// arranges them vertically. By default, it sizes itself to fit its
// children horizontally, and tries to be as tall as its parent.
//
// Column has various properties to control how it sizes itself and
// how it positions its children. Here we use mainAxisAlignment to
// center the children vertically; the main axis here is the vertical
// axis because Columns are vertical (the cross axis would be
// horizontal).
//
// TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
// action in the IDE, or press "p" in the console), to see the
// wireframe for each widget.
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Loading
Loading