Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
6d667e36
Unverified
Commit
6d667e36
authored
Jan 06, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added FABButton to BottomSheet
parent
fd4b56bc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
3 deletions
+76
-3
Sources/iOS/BottomSheetController.swift
+38
-3
Sources/iOS/EdgeInsets.swift
+38
-0
No files found.
Sources/iOS/BottomSheetController.swift
View file @
6d667e36
...
...
@@ -30,10 +30,11 @@
import
UIKit
@objc(BottomSheetPosition)
public
enum
BottomSheetPosition
:
Int
{
@objc(BottomSheet
FABButton
Position)
public
enum
BottomSheet
FABButton
Position
:
Int
{
case
left
case
right
case
center
}
open
class
BottomSheet
:
View
{
...
...
@@ -43,6 +44,23 @@ open class BottomSheet: View {
layoutSubviews
()
}
}
/// A reference to the BottomSheetFABButtonPosition.
open
var
fabButtonPostion
=
BottomSheetFABButtonPosition
.
right
/// A reference to the fabButtonEdgeInsetsPreset.
open
var
fabButtonEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
didSet
{
fabButtonEdgeInsets
=
EdgeInsetsPresetToValue
(
preset
:
fabButtonEdgeInsetsPreset
)
}
}
/// A reference to the fabButtonEdgeInsets.
open
var
fabButtonEdgeInsets
=
EdgeInsets
.
zero
{
didSet
{
layoutSubviews
()
}
}
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
...
...
@@ -52,9 +70,26 @@ open class BottomSheet: View {
v
.
removeFromSuperview
()
addSubview
(
v
)
}
v
.
center
=
CGPoint
(
x
:
20
,
y
:
0
)
var
point
=
center
point
.
y
=
fabButtonEdgeInsets
.
top
-
fabButtonEdgeInsets
.
bottom
switch
fabButtonPostion
{
case
.
left
:
point
.
x
=
v
.
bounds
.
width
/
2
+
fabButtonEdgeInsets
.
left
case
.
right
:
point
.
x
=
bounds
.
width
-
v
.
bounds
.
width
/
2
-
fabButtonEdgeInsets
.
right
case
.
center
:
break
}
v
.
center
=
point
}
}
open
override
func
prepare
()
{
super
.
prepare
()
fabButtonEdgeInsetsPreset
=
.
horizontally5
}
}
extension
BottomSheet
{
...
...
Sources/iOS/EdgeInsets.swift
View file @
6d667e36
...
...
@@ -66,6 +66,20 @@ public enum EdgeInsetsPreset: Int {
case
tallRectangle7
case
tallRectangle8
case
tallRectangle9
/// horizontally
case
horizontally1
case
horizontally2
case
horizontally3
case
horizontally4
case
horizontally5
/// vertically
case
vertically1
case
vertically2
case
vertically3
case
vertically4
case
vertically5
}
public
typealias
EdgeInsets
=
UIEdgeInsets
...
...
@@ -135,5 +149,29 @@ public func EdgeInsetsPresetToValue(preset: EdgeInsetsPreset) -> EdgeInsets {
return
EdgeInsets
(
top
:
56
,
left
:
28
,
bottom
:
56
,
right
:
28
)
case
.
tallRectangle9
:
return
EdgeInsets
(
top
:
64
,
left
:
32
,
bottom
:
64
,
right
:
32
)
/// horizontally
case
.
horizontally1
:
return
EdgeInsets
(
top
:
0
,
left
:
2
,
bottom
:
0
,
right
:
2
)
case
.
horizontally2
:
return
EdgeInsets
(
top
:
0
,
left
:
4
,
bottom
:
0
,
right
:
4
)
case
.
horizontally3
:
return
EdgeInsets
(
top
:
0
,
left
:
8
,
bottom
:
0
,
right
:
8
)
case
.
horizontally4
:
return
EdgeInsets
(
top
:
0
,
left
:
16
,
bottom
:
0
,
right
:
16
)
case
.
horizontally5
:
return
EdgeInsets
(
top
:
0
,
left
:
24
,
bottom
:
0
,
right
:
24
)
/// vertically
case
.
vertically1
:
return
EdgeInsets
(
top
:
2
,
left
:
0
,
bottom
:
2
,
right
:
0
)
case
.
vertically2
:
return
EdgeInsets
(
top
:
4
,
left
:
0
,
bottom
:
4
,
right
:
0
)
case
.
vertically3
:
return
EdgeInsets
(
top
:
8
,
left
:
0
,
bottom
:
8
,
right
:
0
)
case
.
vertically4
:
return
EdgeInsets
(
top
:
16
,
left
:
0
,
bottom
:
16
,
right
:
0
)
case
.
vertically5
:
return
EdgeInsets
(
top
:
24
,
left
:
0
,
bottom
:
24
,
right
:
0
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment