Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature layout #3

Merged
merged 5 commits into from
Jan 17, 2022
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
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
pull_request:
branches:
- main
- master
# pull_request:
# branches:
# - main
# - master
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MyApp extends StatelessWidget {
debugShowCheckedModeBanner: false,
title: 'BringMe',
theme: ThemeData(
primarySwatch: Colors.green,
primarySwatch: Colors.teal,
),
home: AnimatedSplashScreen(
duration: 3000,
Expand Down
12 changes: 6 additions & 6 deletions lib/screeens/dashboard/dashboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class _DashboardState extends State<Dashboard> {
int _selectedIndex = 0;
static const TextStyle optionStyle =
TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
static List<Widget> _widgetOptions = <Widget>[
Home(),
Text(
'Index 1: Business',
static final List<Widget> _widgetOptions = <Widget>[
const Home(),
const Text(
'TODO:: implement cart',
style: optionStyle,
),
Text(
'Index 2: School',
const Text(
'TODO:: implement orders',
style: optionStyle,
),
];
Expand Down
3 changes: 1 addition & 2 deletions lib/screeens/tab_screens/home.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:payhere_demo/widgets/dashboard/image_carousel.dart';
import 'package:payhere_demo/widgets/dashboard/item_card.dart';
import 'package:payhere_demo/widgets/dashboard/item_carousel.dart';

class Home extends StatefulWidget {
Expand Down Expand Up @@ -44,7 +43,7 @@ class _HomeState extends State<Home> {
controller: _customListViewController,
itemCount: Home.items.length,
itemBuilder: (context, index) {
return ListTile(
return const ListTile(
title: ComplicatedImageDemo(),
);
},
Expand Down
20 changes: 10 additions & 10 deletions lib/widgets/dashboard/image_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,51 @@ class _ImageCarouselState extends State<ImageCarousel> {
items: [
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://raw.githubusercontent.com/Shihara-Dilshan/BringMeLK-Android-FireBase/master/app/src/main/res/drawable-hdpi/deliverv2.jpg"),
"https://essstr.blob.core.windows.net/uiimg/Carousel/DirectImportCarousel.jpg"),
),
),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://media.gettyimages.com/photos/delicious-fresh-vegetables-and-fruits-at-the-refrigerated-section-of-picture-id1172975655?s=2048x2048"),
"https://essstr.blob.core.windows.net/uiimg/Carousel/slide9.jpg"),
),
),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://raw.githubusercontent.com/Shihara-Dilshan/BringMeLK-Android-FireBase/master/app/src/main/res/drawable-hdpi/deliverv2.jpg"),
"https://essstr.blob.core.windows.net/uiimg/Carousel/DirectImportCarousel.jpg"),
),
),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?s=612x612"),
"https://essstr.blob.core.windows.net/uiimg/Carousel/slide9.jpg"),
),
),
),
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://media.istockphoto.com/photos/hot-air-balloons-flying-over-the-botan-canyon-in-turkey-picture-id1297349747?s=612x612"),
"https://essstr.blob.core.windows.net/uiimg/Carousel/slide9.jpg"),
),
),
),
Expand Down
101 changes: 96 additions & 5 deletions lib/widgets/dashboard/item_card.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,107 @@
import 'package:flutter/material.dart';
import 'package:payhere_mobilesdk_flutter/payhere_mobilesdk_flutter.dart';

class ItemCard extends StatelessWidget {
const ItemCard({Key? key}) : super(key: key);
ItemCard({Key? key}) : super(key: key);

Map paymentObject = {
"sandbox": true, // true if using Sandbox Merchant ID
"merchant_id": "1217235", // Replace your Merchant ID
"merchant_secret":
"48WqmzPtZlG8QfptjARMIN4JDF4jat5308bRs7gOSx8w", // See step 4e
"notify_url": "http://sample.com/notify",
"order_id": "ItemNo12345",
"items": "Signal Toothpaste Strong Teeth 160g",
"amount": "120.00",
"currency": "LKR",
"first_name": "Shihara",
"last_name": "Dilshan",
"email": "shihara@gmail.com",
"phone": "0750935556",
"address": "No.1, Galle Road",
"city": "Colombo",
"country": "Sri Lanka",
"delivery_address": "No. 46, Galle road, Kalutara South",
"delivery_city": "Kalutara",
"delivery_country": "Sri Lanka",
"custom_1": "",
"custom_2": ""
};

@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(5.0),
margin: const EdgeInsets.only(right: 10.0),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
child: Stack(
children: <Widget>[
Image.network(
'https://essstr.blob.core.windows.net/essimg/350x/Small/Pic7434.jpg',
fit: BoxFit.cover,
width: 1000.0),
const Positioned(
top: 20,
left: 10,
child: Text(
"Signal Toothpaste Strong Teeth 160g",
style: TextStyle(
color: Colors.grey,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
),
const Positioned(
top: 35,
left: 10,
child: Text(
"Rs 120",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
),
Positioned(
bottom: 0,
left: 10,
child: Row(
children: [
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
Colors.black,
),
),
onPressed: () {},
child: const Text('Add to cart'),
),
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
Colors.black,
),
),
onPressed: () {
PayHere.startPayment(paymentObject, (paymentId) {
// print(
// "One Time Payment Success. Payment Id: $paymentId");
}, (error) {
//print("One Time Payment Failed. Error: $error");
}, () {
//print("One Time Payment Dismissed");
});
},
child: const Text('Buy now'),
)
],
),
),
],
),
),
child: Text("items catrd"),
);
}
}
85 changes: 25 additions & 60 deletions lib/widgets/dashboard/item_carousel.dart
Original file line number Diff line number Diff line change
@@ -1,70 +1,35 @@
import 'package:carousel_slider/carousel_slider.dart';
import 'package:flutter/material.dart';

final List<String> imgList = [
'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80',
'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80',
'https://images.unsplash.com/photo-1519125323398-675f0ddb6308?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=94a1e718d89ca60a6337a6008341ca50&auto=format&fit=crop&w=1950&q=80',
'https://images.unsplash.com/photo-1523205771623-e0faa4d2813d?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=89719a0d55dd05e2deae4120227e6efc&auto=format&fit=crop&w=1953&q=80',
'https://images.unsplash.com/photo-1508704019882-f9cf40e475b4?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=8c6e5e3aba713b17aa1fe71ab4f0ae5b&auto=format&fit=crop&w=1352&q=80',
'https://images.unsplash.com/photo-1519985176271-adb1088fa94c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=a0c8d632e977f94e5d312d9893258f59&auto=format&fit=crop&w=1355&q=80'
];

final List<Widget> imageSliders = imgList
.map((item) => Container(
child: Container(
margin: EdgeInsets.only(right: 10.0, bottom: 20.0),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(6.0)),
child: Stack(
children: <Widget>[
Image.network(item, fit: BoxFit.cover, width: 1000.0),
Positioned(
bottom: 0.0,
left: 0.0,
right: 0.0,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromARGB(200, 0, 0, 0),
Color.fromARGB(0, 0, 0, 0)
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
),
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 20.0),
child: Text(
'No. ${imgList.indexOf(item)} image',
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
),
],
)),
),
))
.toList();
import 'package:payhere_demo/widgets/dashboard/item_card.dart';

class ComplicatedImageDemo extends StatelessWidget {
const ComplicatedImageDemo({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container(
child: CarouselSlider(
options: CarouselOptions(
viewportFraction: 0.95,
autoPlay: false,
aspectRatio: 2.0,
enlargeCenterPage: false,
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Most Popular Itemss",
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
const SizedBox(
height: 10,
),
CarouselSlider(
options: CarouselOptions(
viewportFraction: 0.96,
autoPlay: false,
aspectRatio: 1.6,
enlargeCenterPage: false,
),
items: [
ItemCard(),
ItemCard(),
],
),
items: imageSliders,
),
],
);
}
}